# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
319473 |
2020-11-05T10:58:48 Z |
VEGAnn |
Fun Tour (APIO20_fun) |
C++14 |
|
15 ms |
2924 KB |
#include "fun.h"
#include <bits/stdc++.h>
#define PB push_back
#define sz(x) ((int)x.size())
#define i2 array<int,2>
#define all(x) x.begin(),x.end()
using namespace std;
const int N = 100100;
vector<int> g[N], ans;
int siz[N], glob, mx;
bool mrk[N];
void dfs(int v, int p, int len){
if (mx < len){
mx = len;
glob = v;
}
for (int u : g[v]){
if (u == p || mrk[u]) continue;
dfs(u, v, len + 1);
}
}
vector<int> createFunTour(int n, int Q) {
if (n <= 500){
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++){
int now = hoursRequired(i, j);
if (now == 1){
g[i].PB(j);
g[j].PB(i);
}
}
} else {
// for (int i = 1; i < n; i++){
// int j = (i - 1) / 2;
//
// g[i].PB(j);
// g[j].PB(i);
// }
exit(-1);
}
ans.clear();
mx = -1;
dfs(0, -1, 0);
for (int it = 0; it < n; it++){
ans.PB(glob);
mrk[glob] = 1;
mx = -1;
dfs(glob, -1, 0);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2668 KB |
Output is correct |
6 |
Correct |
2 ms |
2668 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2668 KB |
Output is correct |
9 |
Correct |
2 ms |
2688 KB |
Output is correct |
10 |
Correct |
2 ms |
2796 KB |
Output is correct |
11 |
Correct |
3 ms |
2668 KB |
Output is correct |
12 |
Correct |
2 ms |
2668 KB |
Output is correct |
13 |
Correct |
2 ms |
2668 KB |
Output is correct |
14 |
Correct |
2 ms |
2796 KB |
Output is correct |
15 |
Correct |
2 ms |
2700 KB |
Output is correct |
16 |
Correct |
2 ms |
2796 KB |
Output is correct |
17 |
Correct |
2 ms |
2668 KB |
Output is correct |
18 |
Correct |
2 ms |
2668 KB |
Output is correct |
19 |
Correct |
2 ms |
2668 KB |
Output is correct |
20 |
Correct |
2 ms |
2668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2668 KB |
Output is correct |
6 |
Correct |
2 ms |
2668 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2668 KB |
Output is correct |
9 |
Correct |
2 ms |
2688 KB |
Output is correct |
10 |
Correct |
2 ms |
2796 KB |
Output is correct |
11 |
Correct |
3 ms |
2668 KB |
Output is correct |
12 |
Correct |
2 ms |
2668 KB |
Output is correct |
13 |
Correct |
2 ms |
2668 KB |
Output is correct |
14 |
Correct |
2 ms |
2796 KB |
Output is correct |
15 |
Correct |
2 ms |
2700 KB |
Output is correct |
16 |
Correct |
2 ms |
2796 KB |
Output is correct |
17 |
Correct |
2 ms |
2668 KB |
Output is correct |
18 |
Correct |
2 ms |
2668 KB |
Output is correct |
19 |
Correct |
2 ms |
2668 KB |
Output is correct |
20 |
Correct |
2 ms |
2668 KB |
Output is correct |
21 |
Correct |
2 ms |
2816 KB |
Output is correct |
22 |
Correct |
2 ms |
2668 KB |
Output is correct |
23 |
Correct |
2 ms |
2668 KB |
Output is correct |
24 |
Correct |
13 ms |
2796 KB |
Output is correct |
25 |
Correct |
2 ms |
2668 KB |
Output is correct |
26 |
Correct |
3 ms |
2796 KB |
Output is correct |
27 |
Correct |
3 ms |
2668 KB |
Output is correct |
28 |
Correct |
2 ms |
2668 KB |
Output is correct |
29 |
Correct |
13 ms |
2796 KB |
Output is correct |
30 |
Correct |
3 ms |
2796 KB |
Output is correct |
31 |
Correct |
4 ms |
2668 KB |
Output is correct |
32 |
Correct |
5 ms |
2668 KB |
Output is correct |
33 |
Correct |
3 ms |
2668 KB |
Output is correct |
34 |
Correct |
14 ms |
2924 KB |
Output is correct |
35 |
Correct |
14 ms |
2796 KB |
Output is correct |
36 |
Correct |
15 ms |
2796 KB |
Output is correct |
37 |
Correct |
3 ms |
2668 KB |
Output is correct |
38 |
Correct |
14 ms |
2796 KB |
Output is correct |
39 |
Correct |
6 ms |
2668 KB |
Output is correct |
40 |
Correct |
8 ms |
2796 KB |
Output is correct |
41 |
Correct |
4 ms |
2668 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2668 KB |
Output is correct |
6 |
Correct |
2 ms |
2668 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2688 KB |
Output is correct |
9 |
Correct |
2 ms |
2816 KB |
Output is correct |
10 |
Correct |
2 ms |
2668 KB |
Output is correct |
11 |
Correct |
2 ms |
2668 KB |
Output is correct |
12 |
Correct |
13 ms |
2796 KB |
Output is correct |
13 |
Correct |
2 ms |
2668 KB |
Output is correct |
14 |
Correct |
3 ms |
2796 KB |
Output is correct |
15 |
Correct |
3 ms |
2668 KB |
Output is correct |
16 |
Runtime error |
2 ms |
2668 KB |
Execution failed because the return code was nonzero |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2796 KB |
Output is correct |
4 |
Correct |
3 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2668 KB |
Output is correct |
6 |
Correct |
2 ms |
2668 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
13 ms |
2796 KB |
Output is correct |
9 |
Correct |
3 ms |
2796 KB |
Output is correct |
10 |
Correct |
4 ms |
2668 KB |
Output is correct |
11 |
Correct |
5 ms |
2668 KB |
Output is correct |
12 |
Correct |
3 ms |
2668 KB |
Output is correct |
13 |
Runtime error |
2 ms |
2796 KB |
Execution failed because the return code was nonzero |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2668 KB |
Output is correct |
2 |
Correct |
2 ms |
2668 KB |
Output is correct |
3 |
Correct |
2 ms |
2668 KB |
Output is correct |
4 |
Correct |
2 ms |
2668 KB |
Output is correct |
5 |
Correct |
2 ms |
2668 KB |
Output is correct |
6 |
Correct |
2 ms |
2668 KB |
Output is correct |
7 |
Correct |
2 ms |
2668 KB |
Output is correct |
8 |
Correct |
2 ms |
2668 KB |
Output is correct |
9 |
Correct |
2 ms |
2688 KB |
Output is correct |
10 |
Correct |
2 ms |
2796 KB |
Output is correct |
11 |
Correct |
3 ms |
2668 KB |
Output is correct |
12 |
Correct |
2 ms |
2668 KB |
Output is correct |
13 |
Correct |
2 ms |
2668 KB |
Output is correct |
14 |
Correct |
2 ms |
2796 KB |
Output is correct |
15 |
Correct |
2 ms |
2700 KB |
Output is correct |
16 |
Correct |
2 ms |
2796 KB |
Output is correct |
17 |
Correct |
2 ms |
2668 KB |
Output is correct |
18 |
Correct |
2 ms |
2668 KB |
Output is correct |
19 |
Correct |
2 ms |
2668 KB |
Output is correct |
20 |
Correct |
2 ms |
2668 KB |
Output is correct |
21 |
Correct |
2 ms |
2816 KB |
Output is correct |
22 |
Correct |
2 ms |
2668 KB |
Output is correct |
23 |
Correct |
2 ms |
2668 KB |
Output is correct |
24 |
Correct |
13 ms |
2796 KB |
Output is correct |
25 |
Correct |
2 ms |
2668 KB |
Output is correct |
26 |
Correct |
3 ms |
2796 KB |
Output is correct |
27 |
Correct |
3 ms |
2668 KB |
Output is correct |
28 |
Correct |
2 ms |
2668 KB |
Output is correct |
29 |
Correct |
13 ms |
2796 KB |
Output is correct |
30 |
Correct |
3 ms |
2796 KB |
Output is correct |
31 |
Correct |
4 ms |
2668 KB |
Output is correct |
32 |
Correct |
5 ms |
2668 KB |
Output is correct |
33 |
Correct |
3 ms |
2668 KB |
Output is correct |
34 |
Correct |
14 ms |
2924 KB |
Output is correct |
35 |
Correct |
14 ms |
2796 KB |
Output is correct |
36 |
Correct |
15 ms |
2796 KB |
Output is correct |
37 |
Correct |
3 ms |
2668 KB |
Output is correct |
38 |
Correct |
14 ms |
2796 KB |
Output is correct |
39 |
Correct |
6 ms |
2668 KB |
Output is correct |
40 |
Correct |
8 ms |
2796 KB |
Output is correct |
41 |
Correct |
4 ms |
2668 KB |
Output is correct |
42 |
Runtime error |
2 ms |
2668 KB |
Execution failed because the return code was nonzero |
43 |
Halted |
0 ms |
0 KB |
- |