# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
450427 | 2021-08-02T20:59:24 Z | rainboy | Ronald (COCI17_ronald) | C | 60 ms | 3144 KB |
#include <stdio.h> #include <string.h> #define N 1000 int ds[N * 2]; int find(int i) { return ds[i] < 0 ? i : (ds[i] = find(ds[i])); } void join(int i, int j) { i = find(i); j = find(j); if (i == j) return; if (ds[i] > ds[j]) ds[i] = j; else { if (ds[i] == ds[j]) ds[i]--; ds[j] = i; } } int main() { static char adj[N][N]; int n, m, i, j; scanf("%d%d", &n, &m); memset(ds, -1, n * 2 * sizeof *ds); while (m--) { scanf("%d%d", &i, &j), i--, j--; adj[i][j] = adj[j][i] = 1; } for (i = 0; i < n; i++) for (j = i + 1; j < n; j++) if (adj[i][j]) join(i << 1 | 0, j << 1 | 0), join(i << 1 | 1, j << 1 | 1); else join(i << 1 | 0, j << 1 | 1), join(i << 1 | 1, j << 1 | 0); printf(find(0 << 1 | 0) == find(0 << 1 | 1) ? "NE\n" : "DA\n"); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 312 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 276 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 276 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
3 | Correct | 1 ms | 332 KB | Output is correct |
4 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 460 KB | Output is correct |
2 | Correct | 15 ms | 1244 KB | Output is correct |
3 | Correct | 6 ms | 716 KB | Output is correct |
4 | Correct | 4 ms | 588 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 460 KB | Output is correct |
2 | Correct | 10 ms | 972 KB | Output is correct |
3 | Correct | 44 ms | 2500 KB | Output is correct |
4 | Correct | 60 ms | 3144 KB | Output is correct |