We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c9531b commit 0c053cfCopy full SHA for 0c053cf
1 file changed
live10/test104/문제2/황장현.js
@@ -0,0 +1,36 @@
1
+const input = require('fs')
2
+ .readFileSync(process.platform === 'linux' ? '/dev/stdin' : './input.txt')
3
+ .toString()
4
+ .trim()
5
+ .split('\n');
6
+
7
+function solution(input) {
8
+ const N = Number(input[0]);
9
+ const relations = input.slice(1).map((line) => line.split(''));
10
11
+ let max = 0;
12
13
+ for (let i = 0; i < N; i++) {
14
+ const set = new Set();
15
16
+ for (let j = 0; j < N; j++) {
17
+ if (i === j) continue;
18
19
+ if (relations[i][j] === 'Y') {
20
+ set.add(j);
21
+ } else {
22
+ for (let k = 0; k < N; k++) {
23
+ if (relations[i][k] === 'Y' && relations[k][j] === 'Y') {
24
25
+ break;
26
+ }
27
28
29
30
31
+ max = Math.max(max, set.size);
32
33
+ return max;
34
+}
35
36
+console.log(solution(input));
0 commit comments