# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
117662 | 2019-06-17T05:00:56 Z | 이온조(#2879) | Izlet (COI19_izlet) | C++14 | 680 ms | 39532 KB |
#include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; int N; int A[3009][3009], C[3009]; vector<pii> ed; void go(int n, int c) { C[n] = c; for(int i=1; i<=N; i++) { if(!C[i] && A[n][i] == 1) { go(i, c); ed.push_back({n, i}); } } } int main() { int sub; scanf("%d",&sub); scanf("%d",&N); for(int i=1; i<=N; i++) { for(int j=1; j<=N; j++) { scanf("%d",&A[i][j]); } } if(sub == 1) { int c = 1, p = -1; for(int i=1; i<=N; i++) if(!C[i]) { if(p != -1) ed.push_back({i, p}); go(i, c); c = 3 - c; p = i; } for(int i=1; i<=N; i++) printf("%d ", C[i]); for(auto& it: ed) printf("\n%d %d", it.first, it.second); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 667 ms | 37496 KB | Output is correct |
3 | Correct | 666 ms | 37496 KB | Output is correct |
4 | Correct | 680 ms | 39136 KB | Output is correct |
5 | Correct | 674 ms | 39532 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 666 ms | 35832 KB | Unexpected end of file - int32 expected |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 512 KB | Output is correct |
2 | Correct | 667 ms | 37496 KB | Output is correct |
3 | Correct | 666 ms | 37496 KB | Output is correct |
4 | Correct | 680 ms | 39136 KB | Output is correct |
5 | Correct | 674 ms | 39532 KB | Output is correct |
6 | Incorrect | 666 ms | 35832 KB | Unexpected end of file - int32 expected |
7 | Halted | 0 ms | 0 KB | - |