# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
796790 | 2023-07-28T18:13:14 Z | alexander707070 | 기지국 (IOI20_stations) | C++14 | 780 ms | 872 KB |
#include<bits/stdc++.h> #define MAXN 1007 using namespace std; int n,st,et,cnt; vector<int> sol,v[MAXN],w; int tim,in[MAXN],out[MAXN],z[2*MAXN]; void dfs(int x,int p,int dep){ in[x]=tim; tim++; for(int i=0;i<v[x].size();i++){ if(v[x][i]!=p)dfs(v[x][i],x,dep+1); } out[x]=tim; tim++; if(dep%2==0)sol[x]=in[x]; else sol[x]=out[x]; } vector<int> label(int N, int k,vector<int> from,vector<int> to){ n=N; sol.resize(n); for(int i=0;i<n;i++)v[i].clear(); tim=0; for(int i=0;i<n-1;i++){ v[from[i]].push_back(to[i]); v[to[i]].push_back(from[i]); } dfs(0,-1,0); w=sol; sort(w.begin(),w.end()); for(int i=0;i<w.size();i++){ z[w[i]]=i; } for(int i=0;i<sol.size();i++)sol[i]=z[sol[i]]; return sol; } int find_next_station(int s, int t,vector<int> c){ if(s==0){ st=s+1; for(int i=0;i<c.size();i++){ if(t>=st and t<=c[i])return c[i]; st=c[i]+1; } }else if(s<c[0]){ st=s+1; for(int i=0;i<c.size()-1;i++){ if(t>=st and t<=c[i])return c[i]; st=c[i]+1; } return c[c.size()-1]; }else{ et=s-1; for(int i=c.size()-1;i>=1;i--){ if(t>=c[i] and t<=et)return c[i]; } return c[0]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 406 ms | 672 KB | Output is correct |
2 | Correct | 405 ms | 672 KB | Output is correct |
3 | Correct | 562 ms | 420 KB | Output is correct |
4 | Correct | 482 ms | 420 KB | Output is correct |
5 | Correct | 483 ms | 544 KB | Output is correct |
6 | Correct | 418 ms | 656 KB | Output is correct |
7 | Correct | 316 ms | 548 KB | Output is correct |
8 | Correct | 2 ms | 748 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 0 ms | 500 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 414 ms | 524 KB | Output is correct |
2 | Correct | 341 ms | 556 KB | Output is correct |
3 | Correct | 629 ms | 532 KB | Output is correct |
4 | Correct | 515 ms | 548 KB | Output is correct |
5 | Correct | 559 ms | 532 KB | Output is correct |
6 | Correct | 385 ms | 532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 502 ms | 680 KB | Output is correct |
2 | Correct | 411 ms | 676 KB | Output is correct |
3 | Correct | 692 ms | 528 KB | Output is correct |
4 | Correct | 608 ms | 544 KB | Output is correct |
5 | Correct | 480 ms | 548 KB | Output is correct |
6 | Correct | 286 ms | 548 KB | Output is correct |
7 | Correct | 417 ms | 544 KB | Output is correct |
8 | Correct | 1 ms | 628 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 0 ms | 492 KB | Output is correct |
11 | Correct | 426 ms | 544 KB | Output is correct |
12 | Correct | 371 ms | 724 KB | Output is correct |
13 | Correct | 312 ms | 660 KB | Output is correct |
14 | Correct | 376 ms | 548 KB | Output is correct |
15 | Correct | 33 ms | 620 KB | Output is correct |
16 | Correct | 58 ms | 580 KB | Output is correct |
17 | Correct | 68 ms | 536 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 780 ms | 536 KB | Output is correct |
2 | Correct | 496 ms | 548 KB | Output is correct |
3 | Correct | 462 ms | 548 KB | Output is correct |
4 | Correct | 1 ms | 492 KB | Output is correct |
5 | Correct | 1 ms | 456 KB | Output is correct |
6 | Correct | 0 ms | 620 KB | Output is correct |
7 | Correct | 518 ms | 600 KB | Output is correct |
8 | Correct | 772 ms | 544 KB | Output is correct |
9 | Correct | 500 ms | 696 KB | Output is correct |
10 | Correct | 408 ms | 548 KB | Output is correct |
11 | Correct | 5 ms | 492 KB | Output is correct |
12 | Correct | 3 ms | 620 KB | Output is correct |
13 | Correct | 2 ms | 492 KB | Output is correct |
14 | Correct | 2 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 620 KB | Output is correct |
16 | Correct | 483 ms | 532 KB | Output is correct |
17 | Correct | 282 ms | 572 KB | Output is correct |
18 | Correct | 462 ms | 544 KB | Output is correct |
19 | Correct | 423 ms | 420 KB | Output is correct |
20 | Correct | 454 ms | 420 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 471 ms | 660 KB | Output is correct |
2 | Correct | 333 ms | 660 KB | Output is correct |
3 | Correct | 518 ms | 548 KB | Output is correct |
4 | Correct | 425 ms | 548 KB | Output is correct |
5 | Correct | 330 ms | 548 KB | Output is correct |
6 | Correct | 377 ms | 664 KB | Output is correct |
7 | Correct | 354 ms | 548 KB | Output is correct |
8 | Correct | 1 ms | 620 KB | Output is correct |
9 | Correct | 3 ms | 492 KB | Output is correct |
10 | Correct | 1 ms | 620 KB | Output is correct |
11 | Correct | 367 ms | 548 KB | Output is correct |
12 | Correct | 391 ms | 536 KB | Output is correct |
13 | Correct | 681 ms | 536 KB | Output is correct |
14 | Correct | 564 ms | 532 KB | Output is correct |
15 | Correct | 432 ms | 548 KB | Output is correct |
16 | Correct | 353 ms | 536 KB | Output is correct |
17 | Correct | 499 ms | 544 KB | Output is correct |
18 | Correct | 283 ms | 532 KB | Output is correct |
19 | Correct | 412 ms | 760 KB | Output is correct |
20 | Correct | 329 ms | 548 KB | Output is correct |
21 | Correct | 47 ms | 620 KB | Output is correct |
22 | Correct | 63 ms | 620 KB | Output is correct |
23 | Correct | 89 ms | 700 KB | Output is correct |
24 | Correct | 3 ms | 620 KB | Output is correct |
25 | Correct | 4 ms | 620 KB | Output is correct |
26 | Correct | 3 ms | 620 KB | Output is correct |
27 | Correct | 3 ms | 572 KB | Output is correct |
28 | Correct | 0 ms | 496 KB | Output is correct |
29 | Correct | 497 ms | 536 KB | Output is correct |
30 | Correct | 469 ms | 544 KB | Output is correct |
31 | Correct | 420 ms | 532 KB | Output is correct |
32 | Correct | 330 ms | 532 KB | Output is correct |
33 | Correct | 386 ms | 544 KB | Output is correct |
34 | Correct | 219 ms | 680 KB | Output is correct |
35 | Correct | 396 ms | 772 KB | Output is correct |
36 | Correct | 431 ms | 664 KB | Output is correct |
37 | Correct | 407 ms | 656 KB | Output is correct |
38 | Correct | 375 ms | 532 KB | Output is correct |
39 | Correct | 390 ms | 768 KB | Output is correct |
40 | Correct | 327 ms | 660 KB | Output is correct |
41 | Correct | 415 ms | 796 KB | Output is correct |
42 | Correct | 47 ms | 600 KB | Output is correct |
43 | Correct | 70 ms | 720 KB | Output is correct |
44 | Correct | 71 ms | 632 KB | Output is correct |
45 | Correct | 110 ms | 536 KB | Output is correct |
46 | Correct | 289 ms | 532 KB | Output is correct |
47 | Correct | 230 ms | 544 KB | Output is correct |
48 | Correct | 38 ms | 756 KB | Output is correct |
49 | Correct | 46 ms | 872 KB | Output is correct |