#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int INF = (int)1e9 + 7;
const int NS = (int)1e3 + 4;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
int label_num = 0, chk[NS];
memset(chk, 0, sizeof(chk));
vector < int > way[NS];
for(int i = 0; i < n - 1; ++i){
way[u[i]].push_back(v[i]);
way[v[i]].push_back(u[i]);
}
function < void(int, int) > dfs = [&](int x, int dep){
chk[x] = 1;
if(dep % 2) labels[x] = label_num++;
for(auto&nxt:way[x]){
if(chk[nxt]) continue;
dfs(nxt, dep + 1);
}
if(dep % 2 == 0) labels[x] = label_num++;
};
dfs(0, 1);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if((int)c.size() == 1) return c[0];
if(s < c[0]){
if(t < s || t > c[(int)c.size() - 2]) return c.back();
for(auto&i:c){
if(t <= i) return i;
}
}
else{
if(t < c[1] || t > s) return c.front();
for(int i = (int)c.size() - 1; ; --i){
if(t >= i) return c[i];
}
}
return -234;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
546 ms |
1024 KB |
Output is correct |
2 |
Correct |
456 ms |
1024 KB |
Output is correct |
3 |
Correct |
964 ms |
768 KB |
Output is correct |
4 |
Correct |
636 ms |
888 KB |
Output is correct |
5 |
Correct |
570 ms |
892 KB |
Output is correct |
6 |
Correct |
466 ms |
1024 KB |
Output is correct |
7 |
Correct |
449 ms |
772 KB |
Output is correct |
8 |
Correct |
3 ms |
768 KB |
Output is correct |
9 |
Correct |
5 ms |
884 KB |
Output is correct |
10 |
Correct |
2 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
450 ms |
760 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
549 ms |
1008 KB |
Output is correct |
2 |
Correct |
457 ms |
1024 KB |
Output is correct |
3 |
Correct |
875 ms |
868 KB |
Output is correct |
4 |
Correct |
655 ms |
884 KB |
Output is correct |
5 |
Correct |
559 ms |
872 KB |
Output is correct |
6 |
Correct |
442 ms |
1024 KB |
Output is correct |
7 |
Correct |
431 ms |
764 KB |
Output is correct |
8 |
Correct |
3 ms |
880 KB |
Output is correct |
9 |
Correct |
5 ms |
884 KB |
Output is correct |
10 |
Correct |
1 ms |
876 KB |
Output is correct |
11 |
Correct |
598 ms |
768 KB |
Output is correct |
12 |
Correct |
495 ms |
1024 KB |
Output is correct |
13 |
Incorrect |
464 ms |
1008 KB |
Wrong query response. |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
874 ms |
868 KB |
Output is correct |
2 |
Correct |
662 ms |
768 KB |
Output is correct |
3 |
Correct |
615 ms |
880 KB |
Output is correct |
4 |
Correct |
3 ms |
768 KB |
Output is correct |
5 |
Correct |
4 ms |
768 KB |
Output is correct |
6 |
Correct |
2 ms |
768 KB |
Output is correct |
7 |
Correct |
595 ms |
768 KB |
Output is correct |
8 |
Correct |
868 ms |
868 KB |
Output is correct |
9 |
Correct |
651 ms |
880 KB |
Output is correct |
10 |
Correct |
515 ms |
768 KB |
Output is correct |
11 |
Incorrect |
5 ms |
876 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
568 ms |
1024 KB |
Output is correct |
2 |
Correct |
470 ms |
1024 KB |
Output is correct |
3 |
Correct |
1089 ms |
748 KB |
Output is correct |
4 |
Correct |
766 ms |
800 KB |
Output is correct |
5 |
Correct |
781 ms |
768 KB |
Output is correct |
6 |
Correct |
501 ms |
1024 KB |
Output is correct |
7 |
Correct |
576 ms |
896 KB |
Output is correct |
8 |
Correct |
3 ms |
768 KB |
Output is correct |
9 |
Correct |
6 ms |
884 KB |
Output is correct |
10 |
Correct |
2 ms |
896 KB |
Output is correct |
11 |
Incorrect |
537 ms |
896 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |