# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
354388 | 2021-01-21T20:38:15 Z | doowey | 기지국 (IOI20_stations) | C++14 | 1103 ms | 1360 KB |
#include <bits/stdc++.h> #include "stations.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; #define fi first #define se second #define mp make_pair const int N = 1005; vector<int> T[N]; vector<int> sol; int ti; void dfs(int u, int pp, int bit){ if(bit == 0){ sol[u]=ti; ti++; } for(auto x : T[u]){ if(x==pp) continue; dfs(x,u,(bit^1)); } if(bit == 1){ sol[u]=ti; ti++; } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { ti = 0; sol.clear(); sol.resize(n); for(int i = 0 ; i < n; i ++ ){ T[i].clear(); } for(int i = 0 ; i < u.size(); i ++ ){ T[u[i]].push_back(v[i]); T[v[i]].push_back(u[i]); } dfs(0,-1,0); return sol; } int find_next_station(int s, int t, vector<int> c) { for(auto x : c){ if(x == t) return x; } bool is = true; for(auto x : c){ if(s < x) is = false; } if(is){ // s is tout sort(c.begin(), c.end()); if(t <= c[0] || t >= s){ return c[0]; } c.push_back(s); for(int i = 0 ; i + 1 < c.size(); i ++ ){ if(t >= c[i] && t < c[i + 1]){ return c[i]; } } } else{ sort(c.begin(), c.end()); if(t < s) return c.back(); if(t >= c.back()) return c.back(); if(t >= s && t <= c[0]){ return c[0]; } for(int i = 1; i < c.size(); i ++ ){ if(c[i - 1] < t && t <= c[i]){ return c[i]; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 525 ms | 1124 KB | Output is correct |
2 | Correct | 489 ms | 1072 KB | Output is correct |
3 | Correct | 878 ms | 956 KB | Output is correct |
4 | Correct | 671 ms | 952 KB | Output is correct |
5 | Correct | 645 ms | 864 KB | Output is correct |
6 | Correct | 494 ms | 1084 KB | Output is correct |
7 | Correct | 397 ms | 992 KB | Output is correct |
8 | Correct | 3 ms | 904 KB | Output is correct |
9 | Correct | 5 ms | 1080 KB | Output is correct |
10 | Correct | 2 ms | 776 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 530 ms | 884 KB | Output is correct |
2 | Correct | 699 ms | 892 KB | Output is correct |
3 | Correct | 1051 ms | 864 KB | Output is correct |
4 | Correct | 689 ms | 1080 KB | Output is correct |
5 | Correct | 750 ms | 864 KB | Output is correct |
6 | Correct | 469 ms | 900 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 632 ms | 1196 KB | Output is correct |
2 | Correct | 574 ms | 1072 KB | Output is correct |
3 | Correct | 1079 ms | 992 KB | Output is correct |
4 | Correct | 669 ms | 952 KB | Output is correct |
5 | Correct | 652 ms | 960 KB | Output is correct |
6 | Correct | 419 ms | 864 KB | Output is correct |
7 | Correct | 479 ms | 1100 KB | Output is correct |
8 | Correct | 3 ms | 960 KB | Output is correct |
9 | Correct | 5 ms | 864 KB | Output is correct |
10 | Correct | 2 ms | 864 KB | Output is correct |
11 | Correct | 537 ms | 736 KB | Output is correct |
12 | Correct | 479 ms | 1200 KB | Output is correct |
13 | Correct | 545 ms | 1120 KB | Output is correct |
14 | Correct | 506 ms | 908 KB | Output is correct |
15 | Correct | 53 ms | 912 KB | Output is correct |
16 | Correct | 67 ms | 896 KB | Output is correct |
17 | Correct | 114 ms | 736 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 980 ms | 736 KB | Output is correct |
2 | Correct | 844 ms | 952 KB | Output is correct |
3 | Correct | 699 ms | 952 KB | Output is correct |
4 | Correct | 3 ms | 992 KB | Output is correct |
5 | Correct | 4 ms | 952 KB | Output is correct |
6 | Correct | 1 ms | 736 KB | Output is correct |
7 | Correct | 647 ms | 864 KB | Output is correct |
8 | Correct | 834 ms | 952 KB | Output is correct |
9 | Correct | 767 ms | 1024 KB | Output is correct |
10 | Correct | 701 ms | 736 KB | Output is correct |
11 | Correct | 7 ms | 736 KB | Output is correct |
12 | Correct | 5 ms | 864 KB | Output is correct |
13 | Correct | 5 ms | 736 KB | Output is correct |
14 | Correct | 4 ms | 952 KB | Output is correct |
15 | Correct | 2 ms | 864 KB | Output is correct |
16 | Correct | 645 ms | 1012 KB | Output is correct |
17 | Correct | 514 ms | 736 KB | Output is correct |
18 | Correct | 588 ms | 960 KB | Output is correct |
19 | Correct | 561 ms | 952 KB | Output is correct |
20 | Correct | 559 ms | 1108 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 592 ms | 1004 KB | Output is correct |
2 | Correct | 555 ms | 1208 KB | Output is correct |
3 | Correct | 1001 ms | 952 KB | Output is correct |
4 | Correct | 701 ms | 736 KB | Output is correct |
5 | Correct | 736 ms | 952 KB | Output is correct |
6 | Correct | 595 ms | 1076 KB | Output is correct |
7 | Correct | 556 ms | 896 KB | Output is correct |
8 | Correct | 3 ms | 1088 KB | Output is correct |
9 | Correct | 4 ms | 960 KB | Output is correct |
10 | Correct | 2 ms | 736 KB | Output is correct |
11 | Correct | 454 ms | 736 KB | Output is correct |
12 | Correct | 590 ms | 1028 KB | Output is correct |
13 | Correct | 1103 ms | 952 KB | Output is correct |
14 | Correct | 867 ms | 864 KB | Output is correct |
15 | Correct | 591 ms | 952 KB | Output is correct |
16 | Correct | 517 ms | 864 KB | Output is correct |
17 | Correct | 754 ms | 1080 KB | Output is correct |
18 | Correct | 528 ms | 1100 KB | Output is correct |
19 | Correct | 488 ms | 1120 KB | Output is correct |
20 | Correct | 505 ms | 1108 KB | Output is correct |
21 | Correct | 73 ms | 984 KB | Output is correct |
22 | Correct | 87 ms | 916 KB | Output is correct |
23 | Correct | 147 ms | 884 KB | Output is correct |
24 | Correct | 5 ms | 772 KB | Output is correct |
25 | Correct | 7 ms | 960 KB | Output is correct |
26 | Correct | 5 ms | 864 KB | Output is correct |
27 | Correct | 4 ms | 736 KB | Output is correct |
28 | Correct | 1 ms | 736 KB | Output is correct |
29 | Correct | 490 ms | 952 KB | Output is correct |
30 | Correct | 614 ms | 952 KB | Output is correct |
31 | Correct | 478 ms | 864 KB | Output is correct |
32 | Correct | 641 ms | 864 KB | Output is correct |
33 | Correct | 582 ms | 864 KB | Output is correct |
34 | Correct | 367 ms | 1084 KB | Output is correct |
35 | Correct | 456 ms | 992 KB | Output is correct |
36 | Correct | 492 ms | 864 KB | Output is correct |
37 | Correct | 435 ms | 1160 KB | Output is correct |
38 | Correct | 494 ms | 1064 KB | Output is correct |
39 | Correct | 504 ms | 1360 KB | Output is correct |
40 | Correct | 469 ms | 1212 KB | Output is correct |
41 | Correct | 497 ms | 1252 KB | Output is correct |
42 | Correct | 60 ms | 1004 KB | Output is correct |
43 | Correct | 113 ms | 864 KB | Output is correct |
44 | Correct | 162 ms | 868 KB | Output is correct |
45 | Correct | 185 ms | 1148 KB | Output is correct |
46 | Correct | 378 ms | 892 KB | Output is correct |
47 | Correct | 311 ms | 864 KB | Output is correct |
48 | Correct | 80 ms | 1252 KB | Output is correct |
49 | Correct | 74 ms | 1020 KB | Output is correct |