# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
393754 |
2021-04-24T12:39:47 Z |
ronnith |
Izlet (COI19_izlet) |
C++14 |
|
1 ms |
460 KB |
#include <bits/stdc++.h>
using namespace std;
const int N = (int)3e3;
int n, color[N];
int d[N][N];
bool vis[N];
vector<pair<int, int>> edges;
void dfs(int x, int cr) {
vis[x] = true;
color[x] = cr;
for(int i = 0;i < n;i ++) {
if(d[x][i] == 1 && !vis[i]) {
edges.emplace_back(x, i);
dfs(i, cr);
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int sub;
cin >> sub;
if(sub == 1) {
cin >> n;
for(int i = 0;i < n;i ++) {
for(int j = 0;j < n;j ++) {
cin >> d[i][j];
}
}
int prev = -1;
for(int i = 0;i < n;i ++) {
if(!vis[i]) {
dfs(i, i % 2);
if(prev != -1) {
edges.emplace_back(prev, i);
}
prev = i;
}
}
for(int i = 0;i < n;i ++) {
cout << color[i]+1 << ' ';
}
cout << '\n';
for(auto e : edges) {
cout << e.first+1 << ' ' << e.second+1 << '\n';
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |