# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
536320 | 2022-03-12T21:08:05 Z | rainboy | 우호 조약 체결 (JOI14_friends) | C | 4 ms | 932 KB |
#include <stdio.h> #define N 100 char adj[N][N]; int n, cnt; void solve(int i, int j) { int k; if (adj[i][j] != 1) return; adj[i][j] = -1, cnt++; for (k = 0; k < n; k++) if (k != i && k != j && adj[i][k]) { if (!adj[j][k]) adj[j][k] = 1, solve(j, k); if (!adj[k][j]) adj[k][j] = 1, solve(k, j); } } int main() { int m, i, j; scanf("%d%d", &n, &m); while (m--) { scanf("%d%d", &i, &j), i--, j--; adj[i][j] = 1; } for (i = 0; i < n; i++) for (j = 0; j < n; j++) solve(i, j); printf("%d\n", cnt); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 3 ms | 724 KB | Output is correct |
8 | Correct | 4 ms | 724 KB | Output is correct |
9 | Correct | 3 ms | 852 KB | Output is correct |
10 | Correct | 3 ms | 724 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 2 ms | 932 KB | Output is correct |
14 | Correct | 2 ms | 340 KB | Output is correct |
15 | Correct | 1 ms | 296 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 340 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 308 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |