#ifndef EVAL
#include "stub.cpp"
#endif
#include "stations.h"
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
#define pb push_back
#define szof(s) (int)s.size()
#define all(s) s.begin(), s.end()
using namespace std;
const int MAXN = 2005;
vector <int> G[MAXN]; // binary tree
vector <int> g[MAXN]; // cur component
void clean() {
for (int i = 0; i < MAXN; i++) {
g[i].clear();
}
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
clean();
set <int> id;
for (int i = 0; i < n; i++) {
id.insert(i);
}
vector <int> cnt(n, 0);
int center = 0;
for (int i = 0; i <= n - 2; i++) {
int x = u[i];
int y = v[i];
cnt[x]++;
cnt[y]++;
if (cnt[x] >= 2) {
center = x;
}
if (cnt[y] >= 2) {
center = y;
}
}
vector <int> labels(n);
for (int i = 0; i < n; i++) {
if (center == i) {
labels[i] = 0;
id.erase(0);
} else {
auto it = --id.end();
labels[i] = *it;
id.erase(it);
}
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if (c[0] == t) {
assert(s == 0);
return t;
} else {
return 0;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
6 ms |
956 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
12 ms |
912 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
1040 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
960 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
1040 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |