# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
807244 | 2023-08-04T15:12:52 Z | Andrey | 기지국 (IOI20_stations) | C++14 | 838 ms | 1280 KB |
#include "stations.h" #include<bits/stdc++.h> using namespace std; vector<int> yay(0); vector<int> haha[10001]; vector<int> st(10001); void dfs(int a, int t) { st[a] = 1; for(int i = 0; i < haha[a].size(); i++) { if(haha[a][i] != t) { dfs(haha[a][i],a); st[a]+=st[haha[a][i]]; } } } void dude(int a, int t, int d, int l, int r) { if(d%2) { yay[a] = r; r--; } else { yay[a] = l; l++; } for(int i = 0; i < haha[a].size(); i++) { if(haha[a][i] != t) { dude(haha[a][i],a,d+1,l,l+st[haha[a][i]]-1); l+=st[haha[a][i]]; } } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for(int i = 0; i < n; i++) { haha[i].clear(); } for(int i = 0; i < n-1; i++) { haha[u[i]].push_back(v[i]); haha[v[i]].push_back(u[i]); } yay.clear(); for(int i = 0; i < n; i++) { yay.push_back(0); } vector<int> ans(0); dfs(0,-1); dude(0,-1,0,0,n-1); for(int i = 0; i < n; i++) { ans.push_back(yay[i]); } return ans; } int find_next_station(int s, int t, vector<int> c) { if(c.size() == 1) { return c[0]; } if(s >= c[0]) { s%=1000; if(t > s) { return c[0]; } if(t < c[1]) { return c[0]; } for(int i = 1; i < c.size(); i++) { if(t >= c[i] && (i == c.size()-1 || t < c[i+1])) { return c[i]; } } } else { if(s == 0) { for(int i = 0; i < c.size(); i++) { if(c[i] >= t) { return c[i]; } } } else { if(t < s) { return c[c.size()-1]; } if(t > c[c.size()-2]) { return c[c.size()-1]; } for(int i = 0; i < c.size()-1; i++) { if(c[i] >= t) { return c[i]; } } } return -1; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 419 ms | 1168 KB | Output is correct |
2 | Correct | 380 ms | 1028 KB | Output is correct |
3 | Correct | 803 ms | 932 KB | Output is correct |
4 | Correct | 479 ms | 1032 KB | Output is correct |
5 | Correct | 525 ms | 1040 KB | Output is correct |
6 | Correct | 384 ms | 1140 KB | Output is correct |
7 | Correct | 279 ms | 1056 KB | Output is correct |
8 | Correct | 3 ms | 1008 KB | Output is correct |
9 | Correct | 3 ms | 1004 KB | Output is correct |
10 | Correct | 1 ms | 1016 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 406 ms | 1036 KB | Output is correct |
2 | Correct | 504 ms | 1036 KB | Output is correct |
3 | Correct | 745 ms | 1036 KB | Output is correct |
4 | Correct | 525 ms | 1036 KB | Output is correct |
5 | Correct | 352 ms | 1036 KB | Output is correct |
6 | Correct | 386 ms | 1040 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 556 ms | 1064 KB | Output is correct |
2 | Correct | 400 ms | 1152 KB | Output is correct |
3 | Correct | 582 ms | 928 KB | Output is correct |
4 | Correct | 599 ms | 932 KB | Output is correct |
5 | Correct | 579 ms | 932 KB | Output is correct |
6 | Correct | 332 ms | 1036 KB | Output is correct |
7 | Correct | 314 ms | 1056 KB | Output is correct |
8 | Correct | 2 ms | 1016 KB | Output is correct |
9 | Correct | 3 ms | 1008 KB | Output is correct |
10 | Correct | 2 ms | 1016 KB | Output is correct |
11 | Correct | 488 ms | 928 KB | Output is correct |
12 | Correct | 292 ms | 1228 KB | Output is correct |
13 | Correct | 352 ms | 1132 KB | Output is correct |
14 | Correct | 295 ms | 1040 KB | Output is correct |
15 | Correct | 52 ms | 1008 KB | Output is correct |
16 | Correct | 56 ms | 1060 KB | Output is correct |
17 | Correct | 102 ms | 1116 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 788 ms | 996 KB | Output is correct |
2 | Correct | 656 ms | 928 KB | Output is correct |
3 | Correct | 478 ms | 928 KB | Output is correct |
4 | Correct | 2 ms | 1016 KB | Output is correct |
5 | Correct | 4 ms | 1008 KB | Output is correct |
6 | Correct | 0 ms | 1004 KB | Output is correct |
7 | Correct | 493 ms | 1104 KB | Output is correct |
8 | Correct | 838 ms | 1040 KB | Output is correct |
9 | Correct | 527 ms | 932 KB | Output is correct |
10 | Correct | 532 ms | 1040 KB | Output is correct |
11 | Correct | 4 ms | 1008 KB | Output is correct |
12 | Correct | 4 ms | 1008 KB | Output is correct |
13 | Correct | 4 ms | 1016 KB | Output is correct |
14 | Correct | 2 ms | 1004 KB | Output is correct |
15 | Correct | 1 ms | 1008 KB | Output is correct |
16 | Correct | 404 ms | 932 KB | Output is correct |
17 | Correct | 352 ms | 1064 KB | Output is correct |
18 | Correct | 504 ms | 1036 KB | Output is correct |
19 | Correct | 357 ms | 1040 KB | Output is correct |
20 | Correct | 317 ms | 932 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 383 ms | 1056 KB | Output is correct |
2 | Correct | 336 ms | 1152 KB | Output is correct |
3 | Correct | 777 ms | 928 KB | Output is correct |
4 | Correct | 568 ms | 1040 KB | Output is correct |
5 | Correct | 428 ms | 928 KB | Output is correct |
6 | Correct | 357 ms | 1060 KB | Output is correct |
7 | Correct | 397 ms | 1056 KB | Output is correct |
8 | Correct | 1 ms | 1016 KB | Output is correct |
9 | Correct | 3 ms | 1012 KB | Output is correct |
10 | Correct | 1 ms | 1016 KB | Output is correct |
11 | Correct | 429 ms | 1040 KB | Output is correct |
12 | Correct | 495 ms | 1040 KB | Output is correct |
13 | Correct | 752 ms | 1036 KB | Output is correct |
14 | Correct | 487 ms | 1040 KB | Output is correct |
15 | Correct | 549 ms | 932 KB | Output is correct |
16 | Correct | 358 ms | 1056 KB | Output is correct |
17 | Correct | 547 ms | 976 KB | Output is correct |
18 | Correct | 450 ms | 1156 KB | Output is correct |
19 | Correct | 368 ms | 1280 KB | Output is correct |
20 | Correct | 346 ms | 1036 KB | Output is correct |
21 | Correct | 36 ms | 1008 KB | Output is correct |
22 | Correct | 48 ms | 1084 KB | Output is correct |
23 | Correct | 99 ms | 1088 KB | Output is correct |
24 | Correct | 4 ms | 1016 KB | Output is correct |
25 | Correct | 6 ms | 1008 KB | Output is correct |
26 | Correct | 4 ms | 1008 KB | Output is correct |
27 | Correct | 2 ms | 1008 KB | Output is correct |
28 | Correct | 2 ms | 1012 KB | Output is correct |
29 | Correct | 478 ms | 1036 KB | Output is correct |
30 | Correct | 441 ms | 1036 KB | Output is correct |
31 | Correct | 523 ms | 932 KB | Output is correct |
32 | Correct | 393 ms | 932 KB | Output is correct |
33 | Correct | 450 ms | 1040 KB | Output is correct |
34 | Correct | 224 ms | 1036 KB | Output is correct |
35 | Correct | 349 ms | 1264 KB | Output is correct |
36 | Correct | 444 ms | 1144 KB | Output is correct |
37 | Correct | 358 ms | 1160 KB | Output is correct |
38 | Correct | 363 ms | 1228 KB | Output is correct |
39 | Correct | 384 ms | 1232 KB | Output is correct |
40 | Correct | 379 ms | 1160 KB | Output is correct |
41 | Correct | 321 ms | 1152 KB | Output is correct |
42 | Correct | 47 ms | 1168 KB | Output is correct |
43 | Correct | 97 ms | 1056 KB | Output is correct |
44 | Correct | 80 ms | 1032 KB | Output is correct |
45 | Correct | 136 ms | 1132 KB | Output is correct |
46 | Correct | 279 ms | 1036 KB | Output is correct |
47 | Correct | 294 ms | 1036 KB | Output is correct |
48 | Correct | 51 ms | 1184 KB | Output is correct |
49 | Correct | 50 ms | 1244 KB | Output is correct |