#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;
//cout << v << ' ' << ret[v] << endl;
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;
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 s - 1000;
if (t > s) return s + 1000;
return s - 1000;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
284 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 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 |
Runtime error |
1 ms |
416 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
320 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
284 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |