#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> deg(n);
vector<vector<int>> adj(n);
for (int i = 0; i < n - 1; i++)
deg[u[i]]++, deg[v[i]]++, adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]);;
vector<int> labels(n);
// if (*max_element(deg.begin(), deg.end()) <= 2) {
// int r = min_element(deg.begin(), deg.end()) - deg.begin(), p = -1;
// labels[r] = 0;
// for (int i = 1; i < n; i++) {
// if (~p) adj[r].erase(find(adj[r].begin(), adj[r].end(), p));
// tie(r, p) = make_pair(adj[r][0], r);
// labels[r] = i;
// }
// } else {
iota(labels.begin(), labels.end(), 0);
// }
return labels;
}
int find_next_station(int s, int t, vector<int> c) {
set<int> tmp; for (int x: c) tmp.insert(x+1);
int y = t+1;
if (tmp.count(y)) return y-1;
while (y > 0) {
y /= 2;
if (tmp.count(y))
return y-1;
}
return *min_element(c.begin(), c.end());
// return s < t ? *max_element(c.begin(), c.end()) : *min_element(c.begin(), c.end());
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
547 ms |
820 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
462 ms |
840 KB |
Output is correct |
2 |
Correct |
625 ms |
800 KB |
Output is correct |
3 |
Correct |
919 ms |
768 KB |
Output is correct |
4 |
Correct |
848 ms |
644 KB |
Output is correct |
5 |
Correct |
738 ms |
640 KB |
Output is correct |
6 |
Correct |
584 ms |
828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
644 ms |
816 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
879 ms |
656 KB |
Output is correct |
2 |
Correct |
665 ms |
648 KB |
Output is correct |
3 |
Incorrect |
599 ms |
784 KB |
Wrong query response. |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
536 ms |
768 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |