# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
307367 | 2020-09-28T02:21:37 Z | arthur_nascimento | 기지국 (IOI20_stations) | C++14 | 1134 ms | 1224 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define debug #define maxn 1010 int ini[maxn]; int fim[maxn]; int h[maxn]; vector<int> L[maxn]; int cur = 0; void dfs(int x){ debug("dfs %d\n",x); ini[x] = cur++; for(int i : L[x]) if(ini[i] == 0 && i > 0){ h[i] = 1 + h[x]; dfs(i); } fim[x] = cur++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { cur = 0; for(int i=0;i<n;i++) L[i].clear(), h[i] = ini[i] = fim[i] = 0; for(int i=0;i<n-1;i++){ L[u[i]].pb(v[i]); L[v[i]].pb(u[i]); } dfs(0); vector<int> ret; for(int i=0;i<n;i++){ if(h[i]%2 == 0) ret.pb(ini[i]); else ret.pb(fim[i]); } for(int i : ret) debug("%d ",i); debug("\n"); return ret; } int find_next_station(int s, int t, std::vector<int> c) { debug("qr %d %d ~",s,t); for(int i : c) debug("%d ",i); debug("\n"); if(c.size() == 1) return c[0]; sort(c.begin(), c.end()); if(s < c[0]){ // S é entrada, c[i] é saida int pai = c[c.size()-1]; if(t < s) return pai; if(c.size() >= 2 && t > c[c.size()-2]) return pai; for(int i=0;i<c.size();i++){ if(t <= c[i]) return c[i]; } } else { // S é saida, c[i] é entrada int pai = c[0]; if(t > s) return pai; if(t < c[1]) return pai; for(int i=1;i<c.size()-1;i++){ if(t < c[i+1]) return c[i]; } return c[c.size()-1]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 384 KB | Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1990 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 384 KB | Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1022 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 598 ms | 768 KB | Output is correct |
2 | Correct | 537 ms | 1000 KB | Output is correct |
3 | Correct | 891 ms | 1024 KB | Output is correct |
4 | Correct | 695 ms | 1024 KB | Output is correct |
5 | Correct | 636 ms | 768 KB | Output is correct |
6 | Correct | 473 ms | 996 KB | Output is correct |
7 | Correct | 449 ms | 792 KB | Output is correct |
8 | Correct | 2 ms | 880 KB | Output is correct |
9 | Correct | 4 ms | 768 KB | Output is correct |
10 | Correct | 2 ms | 768 KB | Output is correct |
11 | Correct | 702 ms | 768 KB | Output is correct |
12 | Correct | 462 ms | 1000 KB | Output is correct |
13 | Correct | 498 ms | 984 KB | Output is correct |
14 | Correct | 538 ms | 824 KB | Output is correct |
15 | Correct | 63 ms | 864 KB | Output is correct |
16 | Correct | 69 ms | 816 KB | Output is correct |
17 | Correct | 108 ms | 768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1134 ms | 1024 KB | Output is correct |
2 | Correct | 682 ms | 860 KB | Output is correct |
3 | Correct | 573 ms | 864 KB | Output is correct |
4 | Correct | 2 ms | 768 KB | Output is correct |
5 | Correct | 5 ms | 768 KB | Output is correct |
6 | Correct | 2 ms | 768 KB | Output is correct |
7 | Correct | 597 ms | 768 KB | Output is correct |
8 | Correct | 918 ms | 868 KB | Output is correct |
9 | Correct | 766 ms | 868 KB | Output is correct |
10 | Correct | 699 ms | 1024 KB | Output is correct |
11 | Correct | 7 ms | 864 KB | Output is correct |
12 | Correct | 6 ms | 872 KB | Output is correct |
13 | Correct | 5 ms | 768 KB | Output is correct |
14 | Correct | 4 ms | 860 KB | Output is correct |
15 | Correct | 2 ms | 768 KB | Output is correct |
16 | Correct | 502 ms | 876 KB | Output is correct |
17 | Correct | 521 ms | 872 KB | Output is correct |
18 | Correct | 500 ms | 992 KB | Output is correct |
19 | Correct | 548 ms | 872 KB | Output is correct |
20 | Correct | 639 ms | 768 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 613 ms | 1000 KB | Partially correct |
2 | Partially correct | 546 ms | 768 KB | Partially correct |
3 | Correct | 859 ms | 860 KB | Output is correct |
4 | Correct | 672 ms | 768 KB | Output is correct |
5 | Correct | 608 ms | 868 KB | Output is correct |
6 | Partially correct | 514 ms | 1000 KB | Partially correct |
7 | Partially correct | 532 ms | 768 KB | Partially correct |
8 | Correct | 3 ms | 896 KB | Output is correct |
9 | Correct | 4 ms | 876 KB | Output is correct |
10 | Correct | 1 ms | 856 KB | Output is correct |
11 | Partially correct | 488 ms | 804 KB | Partially correct |
12 | Partially correct | 550 ms | 804 KB | Partially correct |
13 | Correct | 879 ms | 864 KB | Output is correct |
14 | Correct | 702 ms | 868 KB | Output is correct |
15 | Correct | 609 ms | 768 KB | Output is correct |
16 | Partially correct | 469 ms | 816 KB | Partially correct |
17 | Correct | 614 ms | 868 KB | Output is correct |
18 | Partially correct | 466 ms | 1224 KB | Partially correct |
19 | Partially correct | 456 ms | 1096 KB | Partially correct |
20 | Partially correct | 469 ms | 768 KB | Partially correct |
21 | Correct | 58 ms | 868 KB | Output is correct |
22 | Partially correct | 70 ms | 824 KB | Partially correct |
23 | Partially correct | 129 ms | 796 KB | Partially correct |
24 | Correct | 6 ms | 876 KB | Output is correct |
25 | Correct | 6 ms | 768 KB | Output is correct |
26 | Correct | 5 ms | 872 KB | Output is correct |
27 | Correct | 4 ms | 768 KB | Output is correct |
28 | Correct | 2 ms | 868 KB | Output is correct |
29 | Correct | 574 ms | 1040 KB | Output is correct |
30 | Correct | 544 ms | 1040 KB | Output is correct |
31 | Correct | 693 ms | 868 KB | Output is correct |
32 | Correct | 507 ms | 768 KB | Output is correct |
33 | Correct | 520 ms | 768 KB | Output is correct |
34 | Partially correct | 334 ms | 968 KB | Partially correct |
35 | Partially correct | 451 ms | 1024 KB | Partially correct |
36 | Partially correct | 457 ms | 888 KB | Partially correct |
37 | Partially correct | 493 ms | 1088 KB | Partially correct |
38 | Partially correct | 554 ms | 784 KB | Partially correct |
39 | Partially correct | 446 ms | 992 KB | Partially correct |
40 | Partially correct | 439 ms | 1012 KB | Partially correct |
41 | Partially correct | 458 ms | 1060 KB | Partially correct |
42 | Partially correct | 70 ms | 816 KB | Partially correct |
43 | Partially correct | 108 ms | 1216 KB | Partially correct |
44 | Partially correct | 136 ms | 784 KB | Partially correct |
45 | Partially correct | 166 ms | 768 KB | Partially correct |
46 | Partially correct | 338 ms | 816 KB | Partially correct |
47 | Partially correct | 308 ms | 932 KB | Partially correct |
48 | Partially correct | 65 ms | 1024 KB | Partially correct |
49 | Partially correct | 70 ms | 1120 KB | Partially correct |