# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
591791 | 2022-07-07T22:56:44 Z | APROHACK | 기지국 (IOI20_stations) | C++14 | 902 ms | 788 KB |
#include "stations.h" #include <bits/stdc++.h> #include <vector> #define ff first #define ss second #define ll long long #define pb push_back using namespace std; const int N = 1005; vector<int>adj[N]; bool vis[N]; int cur = 0; int labeled[N]; void dfs(int node, bool in){ vis[node]=true; if(in)labeled[node]=cur++; for(int i = 0 ;i < adj[node].size() ; i++){ if(!vis[adj[node][i]])dfs(adj[node][i], !in); } if(!in)labeled[node]=cur++; } vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { cur=0; memset(vis, false, sizeof vis); for(int i = 0 ; i < n ; i++){ adj[i].clear(); } vector<int> labels(n); for(int i = 0 ; i < n-1 ; i ++){ adj[u[i]].pb(v[i]); adj[v[i]].pb(u[i]); } dfs(0, true); for(int i = 0 ; i < n ; i ++){ labels[i]=labeled[i]; } return labels; } int find_next_station(int s, int t, vector<int> c) { if(c[0]>s){ //es un in if(t<s || t>=c[c.size()-1]){ return c[c.size()-1]; }else{ int ans = 0; for(int i = c.size()-1 ; i>= 0 ; i--){ if(c[i]>=t)ans=i; } return c[ans]; } }else{ // es un out if(t>s || t<=c[0]){ return c[0]; }else{ int ans = 0; for(int i = 0 ; i < c.size() ; i++){ if(c[i]<=t)ans=i; } return c[ans]; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 520 ms | 544 KB | Output is correct |
2 | Correct | 484 ms | 532 KB | Output is correct |
3 | Correct | 827 ms | 516 KB | Output is correct |
4 | Correct | 598 ms | 544 KB | Output is correct |
5 | Correct | 519 ms | 416 KB | Output is correct |
6 | Correct | 436 ms | 544 KB | Output is correct |
7 | Correct | 401 ms | 544 KB | Output is correct |
8 | Correct | 1 ms | 492 KB | Output is correct |
9 | Correct | 4 ms | 500 KB | Output is correct |
10 | Correct | 2 ms | 492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 485 ms | 532 KB | Output is correct |
2 | Correct | 545 ms | 524 KB | Output is correct |
3 | Correct | 865 ms | 568 KB | Output is correct |
4 | Correct | 671 ms | 536 KB | Output is correct |
5 | Correct | 644 ms | 420 KB | Output is correct |
6 | Correct | 417 ms | 620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 554 ms | 532 KB | Output is correct |
2 | Correct | 394 ms | 548 KB | Output is correct |
3 | Correct | 902 ms | 512 KB | Output is correct |
4 | Correct | 495 ms | 532 KB | Output is correct |
5 | Correct | 545 ms | 416 KB | Output is correct |
6 | Correct | 417 ms | 532 KB | Output is correct |
7 | Correct | 486 ms | 552 KB | Output is correct |
8 | Correct | 2 ms | 500 KB | Output is correct |
9 | Correct | 3 ms | 500 KB | Output is correct |
10 | Correct | 1 ms | 504 KB | Output is correct |
11 | Correct | 562 ms | 528 KB | Output is correct |
12 | Correct | 479 ms | 632 KB | Output is correct |
13 | Correct | 424 ms | 648 KB | Output is correct |
14 | Correct | 341 ms | 544 KB | Output is correct |
15 | Correct | 45 ms | 420 KB | Output is correct |
16 | Correct | 60 ms | 604 KB | Output is correct |
17 | Correct | 125 ms | 544 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 877 ms | 420 KB | Output is correct |
2 | Correct | 591 ms | 416 KB | Output is correct |
3 | Correct | 568 ms | 420 KB | Output is correct |
4 | Correct | 1 ms | 504 KB | Output is correct |
5 | Correct | 1 ms | 492 KB | Output is correct |
6 | Correct | 2 ms | 500 KB | Output is correct |
7 | Correct | 556 ms | 528 KB | Output is correct |
8 | Correct | 835 ms | 416 KB | Output is correct |
9 | Correct | 599 ms | 536 KB | Output is correct |
10 | Correct | 537 ms | 532 KB | Output is correct |
11 | Correct | 4 ms | 492 KB | Output is correct |
12 | Correct | 5 ms | 500 KB | Output is correct |
13 | Correct | 4 ms | 500 KB | Output is correct |
14 | Correct | 3 ms | 492 KB | Output is correct |
15 | Correct | 1 ms | 492 KB | Output is correct |
16 | Correct | 422 ms | 524 KB | Output is correct |
17 | Correct | 487 ms | 416 KB | Output is correct |
18 | Correct | 335 ms | 552 KB | Output is correct |
19 | Correct | 488 ms | 660 KB | Output is correct |
20 | Correct | 510 ms | 532 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 481 ms | 544 KB | Output is correct |
2 | Correct | 439 ms | 548 KB | Output is correct |
3 | Correct | 856 ms | 532 KB | Output is correct |
4 | Correct | 664 ms | 420 KB | Output is correct |
5 | Correct | 575 ms | 420 KB | Output is correct |
6 | Correct | 356 ms | 540 KB | Output is correct |
7 | Correct | 379 ms | 544 KB | Output is correct |
8 | Correct | 2 ms | 492 KB | Output is correct |
9 | Correct | 3 ms | 500 KB | Output is correct |
10 | Correct | 0 ms | 504 KB | Output is correct |
11 | Correct | 462 ms | 528 KB | Output is correct |
12 | Correct | 483 ms | 536 KB | Output is correct |
13 | Correct | 862 ms | 420 KB | Output is correct |
14 | Correct | 586 ms | 416 KB | Output is correct |
15 | Correct | 541 ms | 536 KB | Output is correct |
16 | Correct | 412 ms | 544 KB | Output is correct |
17 | Correct | 582 ms | 528 KB | Output is correct |
18 | Correct | 426 ms | 640 KB | Output is correct |
19 | Correct | 370 ms | 668 KB | Output is correct |
20 | Correct | 428 ms | 532 KB | Output is correct |
21 | Correct | 51 ms | 444 KB | Output is correct |
22 | Correct | 59 ms | 672 KB | Output is correct |
23 | Correct | 138 ms | 672 KB | Output is correct |
24 | Correct | 3 ms | 632 KB | Output is correct |
25 | Correct | 5 ms | 500 KB | Output is correct |
26 | Correct | 3 ms | 500 KB | Output is correct |
27 | Correct | 3 ms | 492 KB | Output is correct |
28 | Correct | 2 ms | 492 KB | Output is correct |
29 | Correct | 543 ms | 420 KB | Output is correct |
30 | Correct | 494 ms | 540 KB | Output is correct |
31 | Correct | 568 ms | 536 KB | Output is correct |
32 | Correct | 508 ms | 532 KB | Output is correct |
33 | Correct | 530 ms | 420 KB | Output is correct |
34 | Correct | 314 ms | 536 KB | Output is correct |
35 | Correct | 477 ms | 664 KB | Output is correct |
36 | Correct | 418 ms | 656 KB | Output is correct |
37 | Correct | 402 ms | 676 KB | Output is correct |
38 | Correct | 455 ms | 644 KB | Output is correct |
39 | Correct | 455 ms | 788 KB | Output is correct |
40 | Correct | 421 ms | 644 KB | Output is correct |
41 | Correct | 500 ms | 648 KB | Output is correct |
42 | Correct | 46 ms | 596 KB | Output is correct |
43 | Correct | 99 ms | 544 KB | Output is correct |
44 | Correct | 116 ms | 528 KB | Output is correct |
45 | Correct | 121 ms | 544 KB | Output is correct |
46 | Correct | 281 ms | 544 KB | Output is correct |
47 | Correct | 276 ms | 520 KB | Output is correct |
48 | Correct | 55 ms | 700 KB | Output is correct |
49 | Correct | 73 ms | 768 KB | Output is correct |