#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 {
labels[i] = *id.begin();
id.erase(id.begin());
}
}
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
if (s == 0) {
return t;
} else {
return c[0];
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
380 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
456 KB |
Invalid labels (duplicates values). scenario=1, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
865 ms |
776 KB |
Output is correct |
2 |
Incorrect |
1 ms |
328 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
388 KB |
Invalid labels (duplicates values). scenario=0, label=0 |
2 |
Halted |
0 ms |
0 KB |
- |