# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
234258 |
2020-05-23T14:34:33 Z |
VEGAnn |
Izlet (COI19_izlet) |
C++14 |
|
728 ms |
50528 KB |
#include <bits/stdc++.h>
#define PB push_back
#define a2 array<int,2>
using namespace std;
const int N = 3010;
const int M = 1010;
const int oo = 2e9;
int ans[N], a[N][N], n, kol = 1;
bool mrk[N];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAL
cin >> n;
assert(n == 2);
cin >> n;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
cin >> a[i][j];
ans[0] = 1;
for (int i = 1; i < n; i++){
bool ok = 0;
fill(mrk, mrk + n, 0);
int cnt = 0;
for (int j = i - 1; j >= 0; j--) {
if (!mrk[ans[j]])
cnt++;
mrk[ans[j]] = 1;
if (a[i][j] == cnt){
ok = 1;
ans[i] = ans[j];
break;
}
}
if (!ok)
ans[i] = ++kol;
}
for (int i = 0; i < n; i++){
int cnt = 0;
fill(mrk + 1, mrk + n + 1, 0);
for (int j = i; j < n; j++){
if (!mrk[ans[j]])
cnt++;
mrk[ans[j]] = 1;
assert(cnt == a[i][j] && cnt == a[j][i]);
}
}
for (int i = 0; i < n; i++)
cout << ans[i] << " ";
cout << '\n';
for (int i = 1; i < n; i++)
cout << i << " " << i + 1 << '\n';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
564 ms |
35832 KB |
Output is correct |
2 |
Correct |
502 ms |
47992 KB |
Output is correct |
3 |
Correct |
691 ms |
50528 KB |
Output is correct |
4 |
Correct |
728 ms |
37368 KB |
Output is correct |
5 |
Correct |
562 ms |
36472 KB |
Output is correct |
6 |
Correct |
585 ms |
36508 KB |
Output is correct |
7 |
Correct |
408 ms |
30968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
7 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |