We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 05495ca commit 8cfb1fbCopy full SHA for 8cfb1fb
1 file changed
live8/test82/문제2/황장현.js
@@ -0,0 +1,33 @@
1
+const fs = require('fs');
2
+
3
+const input = fs
4
+ .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
5
+ .toString()
6
+ .trim()
7
+ .split('\n')
8
+ .map((el) => el.split(' ').map(Number));
9
10
+function solution(input) {
11
+ const [N, M] = input[0];
12
+ const relation = input.slice(1);
13
+ const graph = Array.from({ length: N + 1 }).map((_) =>
14
+ Array.from({ length: 0 })
15
+ );
16
17
+ for (const [f1, f2] of relation) {
18
+ graph[f1].push(f2);
19
+ graph[f2].push(f1);
20
+ }
21
22
+ function dfs(start, target) {}
23
24
+ for (let i = 1; i <= N; i++) {
25
+ const temp = [];
26
+ for (let j = 1; j <= N; j++) {
27
+ if (graph[i].includes(j)) temp.push(1);
28
+ else dfs(i, j);
29
30
31
+}
32
33
+console.log(solution(input));
0 commit comments