#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];
}
}
while(1){
puts("WHAT");
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
639 ms |
1024 KB |
Output is correct |
2 |
Correct |
554 ms |
1000 KB |
Output is correct |
3 |
Correct |
1027 ms |
760 KB |
Output is correct |
4 |
Correct |
689 ms |
896 KB |
Output is correct |
5 |
Correct |
788 ms |
880 KB |
Output is correct |
6 |
Correct |
464 ms |
864 KB |
Output is correct |
7 |
Correct |
526 ms |
1024 KB |
Output is correct |
8 |
Correct |
3 ms |
1008 KB |
Output is correct |
9 |
Correct |
6 ms |
832 KB |
Output is correct |
10 |
Correct |
2 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
605 ms |
880 KB |
Wrong query response. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
524 ms |
1024 KB |
Output is correct |
2 |
Correct |
490 ms |
1024 KB |
Output is correct |
3 |
Correct |
975 ms |
768 KB |
Output is correct |
4 |
Correct |
783 ms |
896 KB |
Output is correct |
5 |
Correct |
598 ms |
876 KB |
Output is correct |
6 |
Correct |
453 ms |
1020 KB |
Output is correct |
7 |
Correct |
447 ms |
776 KB |
Output is correct |
8 |
Correct |
2 ms |
880 KB |
Output is correct |
9 |
Correct |
4 ms |
768 KB |
Output is correct |
10 |
Correct |
2 ms |
872 KB |
Output is correct |
11 |
Correct |
615 ms |
768 KB |
Output is correct |
12 |
Correct |
508 ms |
1120 KB |
Output is correct |
13 |
Incorrect |
479 ms |
1008 KB |
Wrong query response. |
14 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
885 ms |
764 KB |
Output is correct |
2 |
Correct |
708 ms |
880 KB |
Output is correct |
3 |
Correct |
566 ms |
760 KB |
Output is correct |
4 |
Correct |
3 ms |
876 KB |
Output is correct |
5 |
Correct |
4 ms |
888 KB |
Output is correct |
6 |
Correct |
2 ms |
768 KB |
Output is correct |
7 |
Correct |
600 ms |
880 KB |
Output is correct |
8 |
Correct |
868 ms |
768 KB |
Output is correct |
9 |
Correct |
646 ms |
876 KB |
Output is correct |
10 |
Correct |
576 ms |
784 KB |
Output is correct |
11 |
Incorrect |
6 ms |
880 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
541 ms |
1008 KB |
Output is correct |
2 |
Correct |
513 ms |
1024 KB |
Output is correct |
3 |
Correct |
1006 ms |
768 KB |
Output is correct |
4 |
Correct |
644 ms |
660 KB |
Output is correct |
5 |
Correct |
667 ms |
1008 KB |
Output is correct |
6 |
Correct |
492 ms |
1024 KB |
Output is correct |
7 |
Correct |
433 ms |
896 KB |
Output is correct |
8 |
Correct |
3 ms |
884 KB |
Output is correct |
9 |
Correct |
6 ms |
880 KB |
Output is correct |
10 |
Correct |
2 ms |
768 KB |
Output is correct |
11 |
Incorrect |
457 ms |
768 KB |
Wrong query response. |
12 |
Halted |
0 ms |
0 KB |
- |