# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
305000 | 2020-09-22T11:19:48 Z | Pajaraja | 기지국 (IOI20_stations) | C++17 | 1228 ms | 1280 KB |
#include "stations.h" #include <bits/stdc++.h> #define MAXN 1007 using namespace std; static int lb[MAXN],t; static vector<int> g[MAXN]; void dfs(int s,int f,int d) { if(!d) lb[s]=t++; for(int i=0;i<g[s].size();i++) if(g[s][i]!=f) dfs(g[s][i],s,d^1); if(d) lb[s]=t++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for(int i=0;i<n-1;i++) g[u[i]].push_back(v[i]); for(int i=0;i<n-1;i++) g[v[i]].push_back(u[i]); dfs(0,0,0); t=0; for(int i=0;i<n;i++) g[i].clear(); std::vector<int> labels(n); for (int i = 0; i < n; i++) labels[i] = lb[i]; return labels; } int find_next_station(int s, int t, std::vector<int> c) { if(s<c[0]) { sort(c.begin(),c.end()); vector<int> aux; for(int i=0;i+1<c.size();i++) aux.push_back(c[i]); if(c.size()==1) return c[0]; if(s==0) aux.push_back(c[c.size()-1]); if(t>s && t<=aux[0]) return aux[0]; for(int i=1;i<aux.size();i++) if(t>aux[i-1] && t<=aux[i]) return aux[i]; return c[c.size()-1]; } else { sort(c.begin(),c.end()); vector<int> aux; if(c.size()==1) return c[0]; for(int i=1;i<c.size();i++) aux.push_back(c[i]); for(int i=0;i+1<aux.size();i++) if(t>=aux[i] && t<aux[i+1]) return aux[i]; if(t<s && t>=aux[aux.size()-1]) return aux[aux.size()-1]; return c[0]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 708 ms | 1024 KB | Output is correct |
2 | Correct | 603 ms | 1280 KB | Output is correct |
3 | Correct | 1124 ms | 768 KB | Output is correct |
4 | Correct | 928 ms | 768 KB | Output is correct |
5 | Correct | 795 ms | 672 KB | Output is correct |
6 | Correct | 511 ms | 1024 KB | Output is correct |
7 | Correct | 534 ms | 896 KB | Output is correct |
8 | Correct | 3 ms | 780 KB | Output is correct |
9 | Correct | 7 ms | 768 KB | Output is correct |
10 | Correct | 1 ms | 780 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 581 ms | 896 KB | Output is correct |
2 | Correct | 573 ms | 768 KB | Output is correct |
3 | Correct | 1025 ms | 768 KB | Output is correct |
4 | Correct | 830 ms | 896 KB | Output is correct |
5 | Correct | 625 ms | 768 KB | Output is correct |
6 | Correct | 533 ms | 820 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 761 ms | 1028 KB | Output is correct |
2 | Correct | 628 ms | 1032 KB | Output is correct |
3 | Correct | 1101 ms | 884 KB | Output is correct |
4 | Correct | 830 ms | 904 KB | Output is correct |
5 | Correct | 748 ms | 808 KB | Output is correct |
6 | Correct | 545 ms | 1024 KB | Output is correct |
7 | Correct | 496 ms | 1024 KB | Output is correct |
8 | Correct | 3 ms | 776 KB | Output is correct |
9 | Correct | 5 ms | 680 KB | Output is correct |
10 | Correct | 2 ms | 768 KB | Output is correct |
11 | Correct | 787 ms | 896 KB | Output is correct |
12 | Correct | 659 ms | 1032 KB | Output is correct |
13 | Correct | 580 ms | 1136 KB | Output is correct |
14 | Correct | 526 ms | 808 KB | Output is correct |
15 | Correct | 74 ms | 768 KB | Output is correct |
16 | Correct | 69 ms | 768 KB | Output is correct |
17 | Correct | 146 ms | 896 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1228 ms | 776 KB | Output is correct |
2 | Correct | 789 ms | 896 KB | Output is correct |
3 | Correct | 667 ms | 896 KB | Output is correct |
4 | Correct | 3 ms | 896 KB | Output is correct |
5 | Correct | 5 ms | 768 KB | Output is correct |
6 | Correct | 0 ms | 872 KB | Output is correct |
7 | Correct | 634 ms | 768 KB | Output is correct |
8 | Correct | 1059 ms | 896 KB | Output is correct |
9 | Correct | 813 ms | 784 KB | Output is correct |
10 | Correct | 696 ms | 1024 KB | Output is correct |
11 | Correct | 8 ms | 876 KB | Output is correct |
12 | Correct | 8 ms | 768 KB | Output is correct |
13 | Correct | 7 ms | 780 KB | Output is correct |
14 | Correct | 5 ms | 800 KB | Output is correct |
15 | Correct | 2 ms | 768 KB | Output is correct |
16 | Correct | 511 ms | 896 KB | Output is correct |
17 | Correct | 733 ms | 768 KB | Output is correct |
18 | Correct | 649 ms | 768 KB | Output is correct |
19 | Correct | 605 ms | 896 KB | Output is correct |
20 | Correct | 581 ms | 768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 650 ms | 1048 KB | Output is correct |
2 | Correct | 544 ms | 1008 KB | Output is correct |
3 | Correct | 1035 ms | 776 KB | Output is correct |
4 | Correct | 723 ms | 812 KB | Output is correct |
5 | Correct | 743 ms | 776 KB | Output is correct |
6 | Correct | 569 ms | 1048 KB | Output is correct |
7 | Correct | 557 ms | 912 KB | Output is correct |
8 | Correct | 3 ms | 768 KB | Output is correct |
9 | Correct | 7 ms | 768 KB | Output is correct |
10 | Correct | 3 ms | 776 KB | Output is correct |
11 | Correct | 552 ms | 800 KB | Output is correct |
12 | Correct | 572 ms | 908 KB | Output is correct |
13 | Correct | 1037 ms | 928 KB | Output is correct |
14 | Correct | 756 ms | 840 KB | Output is correct |
15 | Correct | 766 ms | 792 KB | Output is correct |
16 | Correct | 510 ms | 792 KB | Output is correct |
17 | Correct | 698 ms | 900 KB | Output is correct |
18 | Correct | 519 ms | 908 KB | Output is correct |
19 | Correct | 616 ms | 1148 KB | Output is correct |
20 | Correct | 491 ms | 768 KB | Output is correct |
21 | Correct | 58 ms | 896 KB | Output is correct |
22 | Correct | 107 ms | 768 KB | Output is correct |
23 | Correct | 106 ms | 768 KB | Output is correct |
24 | Correct | 5 ms | 768 KB | Output is correct |
25 | Correct | 5 ms | 768 KB | Output is correct |
26 | Correct | 6 ms | 896 KB | Output is correct |
27 | Correct | 4 ms | 768 KB | Output is correct |
28 | Correct | 2 ms | 768 KB | Output is correct |
29 | Correct | 592 ms | 928 KB | Output is correct |
30 | Correct | 614 ms | 928 KB | Output is correct |
31 | Correct | 622 ms | 768 KB | Output is correct |
32 | Correct | 573 ms | 768 KB | Output is correct |
33 | Correct | 650 ms | 904 KB | Output is correct |
34 | Correct | 368 ms | 1024 KB | Output is correct |
35 | Correct | 535 ms | 1024 KB | Output is correct |
36 | Correct | 543 ms | 1024 KB | Output is correct |
37 | Correct | 512 ms | 1024 KB | Output is correct |
38 | Correct | 449 ms | 976 KB | Output is correct |
39 | Correct | 434 ms | 896 KB | Output is correct |
40 | Correct | 489 ms | 888 KB | Output is correct |
41 | Correct | 599 ms | 1104 KB | Output is correct |
42 | Correct | 98 ms | 896 KB | Output is correct |
43 | Correct | 140 ms | 896 KB | Output is correct |
44 | Correct | 179 ms | 1024 KB | Output is correct |
45 | Correct | 229 ms | 1024 KB | Output is correct |
46 | Correct | 396 ms | 896 KB | Output is correct |
47 | Correct | 453 ms | 768 KB | Output is correct |
48 | Correct | 66 ms | 896 KB | Output is correct |
49 | Correct | 77 ms | 1008 KB | Output is correct |