Skip to content

Commit

Permalink
WIP: 서울 지하철 2호선
Browse files Browse the repository at this point in the history
  • Loading branch information
luckylooky2 committed Jul 30, 2024
1 parent 21fa7d0 commit 3a88423
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions baekjoon/16947(WIP).js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 서울 지하철 2호선
const input = require("fs")
.readFileSync("/dev/stdin")
.toString()
.trim()
.split("\n")
.map((v) => v.split(" ").map((v) => Number(v)));
const [n] = input.shift();
const edges = input.map(([a, b]) => {
if (a < b) {
return [a, b];
} else {
return [b, a];
}
});
const next = new Array(n).fill(null).map(() => new Array(0));
const count = new Array(n + 1).fill(0);

for (const [a, b] of edges) {
next[a].push(b);
next[b].push(a);
}

console.log(next);

// 순환 구간을 어떻게 판단?

0 comments on commit 3a88423

Please sign in to comment.