#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int cnt, cnt2;
vector<int> ret;
vector<vector<int>> adj;
void dfs(int v, int p) {
ret[v] = 1000*cnt2 + cnt;
cnt2++;
for (auto to : adj[v]) {
if (to != p) {
dfs(to, v);
}
}
return;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
adj.assign(n, vector<int>());
for (int i=0; i<(int)u.size(); i++) {
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
for (int i=0; i<n; i++) {
if (adj[i].size() > 2) {
ret.assign(n, 0);
ret[i] = 0;
cnt = 1;
for (auto x : adj[i]) {
cnt2 = 0;
dfs(x, i);
cnt++;
}
return ret;
}
}
cnt = 1;
ret.assign(n, 0);
ret[0] = 0;
for (auto x : adj[0]) {
cnt2 = 0;
dfs(x, 0);
cnt++;
}
return ret;
}
int find_next_station(int s, int t, vector<int> c) {
if (!s) return t % 1000;
if (s%1000 != t%1000) return max(0, s - 1000);
if (t > s) return s + 1000;
return max(0, s - 1000);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
408 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=4002 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
412 KB |
Invalid labels (values out of range). scenario=0, k=1000, vertex=2, label=1001 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
520 ms |
636 KB |
Output is correct |
2 |
Correct |
457 ms |
660 KB |
Output is correct |
3 |
Correct |
883 ms |
404 KB |
Output is correct |
4 |
Correct |
609 ms |
492 KB |
Output is correct |
5 |
Correct |
602 ms |
488 KB |
Output is correct |
6 |
Correct |
403 ms |
528 KB |
Output is correct |
7 |
Correct |
409 ms |
484 KB |
Output is correct |
8 |
Correct |
3 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
1 ms |
476 KB |
Output is correct |
11 |
Correct |
546 ms |
488 KB |
Output is correct |
12 |
Correct |
473 ms |
596 KB |
Output is correct |
13 |
Correct |
512 ms |
552 KB |
Output is correct |
14 |
Correct |
491 ms |
520 KB |
Output is correct |
15 |
Correct |
52 ms |
508 KB |
Output is correct |
16 |
Correct |
67 ms |
544 KB |
Output is correct |
17 |
Correct |
85 ms |
484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
780 ms |
468 KB |
Output is correct |
2 |
Correct |
702 ms |
492 KB |
Output is correct |
3 |
Correct |
539 ms |
400 KB |
Output is correct |
4 |
Correct |
2 ms |
476 KB |
Output is correct |
5 |
Correct |
4 ms |
468 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
627 ms |
492 KB |
Output is correct |
8 |
Correct |
681 ms |
404 KB |
Output is correct |
9 |
Correct |
660 ms |
404 KB |
Output is correct |
10 |
Correct |
529 ms |
464 KB |
Output is correct |
11 |
Incorrect |
6 ms |
468 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
538 ms |
528 KB |
Partially correct |
2 |
Partially correct |
452 ms |
528 KB |
Partially correct |
3 |
Correct |
895 ms |
492 KB |
Output is correct |
4 |
Partially correct |
730 ms |
488 KB |
Partially correct |
5 |
Partially correct |
593 ms |
616 KB |
Partially correct |
6 |
Partially correct |
447 ms |
616 KB |
Partially correct |
7 |
Partially correct |
395 ms |
528 KB |
Partially correct |
8 |
Partially correct |
3 ms |
468 KB |
Partially correct |
9 |
Partially correct |
5 ms |
476 KB |
Partially correct |
10 |
Partially correct |
1 ms |
464 KB |
Partially correct |
11 |
Incorrect |
425 ms |
612 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |