# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
433399 | 2021-06-19T16:56:29 Z | Enkognit | 기지국 (IOI20_stations) | C++14 | 884 ms | 864 KB |
#include <bits/stdc++.h> #include "stations.h" #include <vector> #define ll long long #define mp make_pair #define pb push_back #define fi first #define se second using namespace std; vector<int> c[1005]; vector<int> vv; ll T; void dfs(int h,int k, int p) { if (k%2==0) vv[h]=T++; for (int i = 0; i < c[h].size(); i++) if (c[h][i]!=p) { dfs(c[h][i], k+1, h); } if (k%2) vv[h]=T++; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { vector<int> f; vv.resize(n, 0); T=0; vector<pair<ll, ll> > ed; for (int i = 0; i < u.size(); i++) { ed.pb(mp(u[i], v[i])); c[u[i]].pb(v[i]); c[v[i]].pb(u[i]); } dfs(0, 0, 0); f.resize(n, 0); f=vv; vv.clear(); //for (int i = 0; i < n; i++) cout << vv[i] << "\n"; //for (int i = 0; i < ed.size(); i++) // cout << vv[ed[i].fi] << " " << vv[ed[i].se] << "\n"; //cout << "---\n"; for (int i = 0; i < n; i++) c[i].clear(); return f; } int find_next_station(int s, int t, std::vector<int> c) { /*cout << c.size() << " : "; for (int i = 0; i < c.size(); i++) cout << c[i] << " "; cout << "\n"; cout << s << "\n";*/ if (s==t) return s; if (c.size()==1) return c[0]; //cout << "\n"; //assert((int)c.size()==0); if (s<c[0]) { if (!(t>s && t<c.back())) return c.back(); ll lst=s; for (int i = 0; i < c.size()-1; i++) if (t>lst && c[i]>=t) return c[i]; else lst=c[i]; return c.back(); }else { if (!(t<s && t>c[0])) return c[0]; ll lst=s; for (int i = c.size()-1; i > 0; i--) if (t<lst && t>=c[i]) return c[i]; else lst=c[i]; return c[0]; } assert(0); return 1; } /* 1 5 10 0 1 1 2 1 3 2 4 2 2 0 2 1 3 3 */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 564 ms | 644 KB | Output is correct |
2 | Correct | 471 ms | 648 KB | Output is correct |
3 | Correct | 855 ms | 504 KB | Output is correct |
4 | Correct | 650 ms | 512 KB | Output is correct |
5 | Correct | 629 ms | 456 KB | Output is correct |
6 | Correct | 508 ms | 616 KB | Output is correct |
7 | Correct | 484 ms | 640 KB | Output is correct |
8 | Correct | 3 ms | 480 KB | Output is correct |
9 | Correct | 5 ms | 540 KB | Output is correct |
10 | Correct | 2 ms | 468 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 450 ms | 528 KB | Output is correct |
2 | Correct | 546 ms | 584 KB | Output is correct |
3 | Correct | 884 ms | 456 KB | Output is correct |
4 | Correct | 694 ms | 508 KB | Output is correct |
5 | Correct | 591 ms | 404 KB | Output is correct |
6 | Correct | 412 ms | 528 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 537 ms | 772 KB | Output is correct |
2 | Correct | 497 ms | 636 KB | Output is correct |
3 | Correct | 872 ms | 472 KB | Output is correct |
4 | Correct | 627 ms | 400 KB | Output is correct |
5 | Correct | 576 ms | 568 KB | Output is correct |
6 | Correct | 445 ms | 712 KB | Output is correct |
7 | Correct | 460 ms | 728 KB | Output is correct |
8 | Correct | 3 ms | 468 KB | Output is correct |
9 | Correct | 5 ms | 468 KB | Output is correct |
10 | Correct | 2 ms | 552 KB | Output is correct |
11 | Correct | 666 ms | 516 KB | Output is correct |
12 | Correct | 451 ms | 736 KB | Output is correct |
13 | Correct | 457 ms | 864 KB | Output is correct |
14 | Correct | 471 ms | 528 KB | Output is correct |
15 | Correct | 56 ms | 648 KB | Output is correct |
16 | Correct | 71 ms | 528 KB | Output is correct |
17 | Correct | 125 ms | 796 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 812 ms | 400 KB | Output is correct |
2 | Correct | 699 ms | 400 KB | Output is correct |
3 | Correct | 623 ms | 508 KB | Output is correct |
4 | Correct | 3 ms | 468 KB | Output is correct |
5 | Correct | 3 ms | 468 KB | Output is correct |
6 | Correct | 0 ms | 468 KB | Output is correct |
7 | Correct | 570 ms | 400 KB | Output is correct |
8 | Correct | 876 ms | 400 KB | Output is correct |
9 | Correct | 619 ms | 508 KB | Output is correct |
10 | Correct | 575 ms | 516 KB | Output is correct |
11 | Correct | 5 ms | 468 KB | Output is correct |
12 | Correct | 5 ms | 448 KB | Output is correct |
13 | Correct | 5 ms | 468 KB | Output is correct |
14 | Correct | 4 ms | 468 KB | Output is correct |
15 | Correct | 2 ms | 476 KB | Output is correct |
16 | Correct | 494 ms | 400 KB | Output is correct |
17 | Correct | 511 ms | 400 KB | Output is correct |
18 | Correct | 491 ms | 544 KB | Output is correct |
19 | Correct | 483 ms | 508 KB | Output is correct |
20 | Correct | 510 ms | 412 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 497 ms | 636 KB | Output is correct |
2 | Correct | 452 ms | 528 KB | Output is correct |
3 | Correct | 856 ms | 400 KB | Output is correct |
4 | Correct | 610 ms | 400 KB | Output is correct |
5 | Correct | 576 ms | 528 KB | Output is correct |
6 | Correct | 459 ms | 628 KB | Output is correct |
7 | Correct | 438 ms | 496 KB | Output is correct |
8 | Correct | 3 ms | 468 KB | Output is correct |
9 | Correct | 4 ms | 468 KB | Output is correct |
10 | Correct | 2 ms | 468 KB | Output is correct |
11 | Correct | 407 ms | 540 KB | Output is correct |
12 | Correct | 512 ms | 520 KB | Output is correct |
13 | Correct | 861 ms | 528 KB | Output is correct |
14 | Correct | 614 ms | 400 KB | Output is correct |
15 | Correct | 579 ms | 512 KB | Output is correct |
16 | Correct | 437 ms | 512 KB | Output is correct |
17 | Correct | 569 ms | 516 KB | Output is correct |
18 | Correct | 453 ms | 764 KB | Output is correct |
19 | Correct | 450 ms | 632 KB | Output is correct |
20 | Correct | 409 ms | 508 KB | Output is correct |
21 | Correct | 62 ms | 528 KB | Output is correct |
22 | Correct | 67 ms | 560 KB | Output is correct |
23 | Correct | 106 ms | 528 KB | Output is correct |
24 | Correct | 6 ms | 468 KB | Output is correct |
25 | Correct | 6 ms | 472 KB | Output is correct |
26 | Correct | 6 ms | 476 KB | Output is correct |
27 | Correct | 3 ms | 476 KB | Output is correct |
28 | Correct | 2 ms | 460 KB | Output is correct |
29 | Correct | 502 ms | 404 KB | Output is correct |
30 | Correct | 505 ms | 508 KB | Output is correct |
31 | Correct | 503 ms | 528 KB | Output is correct |
32 | Correct | 492 ms | 508 KB | Output is correct |
33 | Correct | 481 ms | 400 KB | Output is correct |
34 | Correct | 324 ms | 656 KB | Output is correct |
35 | Correct | 442 ms | 648 KB | Output is correct |
36 | Correct | 436 ms | 624 KB | Output is correct |
37 | Correct | 418 ms | 628 KB | Output is correct |
38 | Correct | 453 ms | 760 KB | Output is correct |
39 | Correct | 429 ms | 640 KB | Output is correct |
40 | Correct | 464 ms | 748 KB | Output is correct |
41 | Correct | 460 ms | 636 KB | Output is correct |
42 | Correct | 64 ms | 528 KB | Output is correct |
43 | Correct | 97 ms | 556 KB | Output is correct |
44 | Correct | 121 ms | 528 KB | Output is correct |
45 | Correct | 169 ms | 528 KB | Output is correct |
46 | Correct | 334 ms | 528 KB | Output is correct |
47 | Correct | 298 ms | 512 KB | Output is correct |
48 | Correct | 54 ms | 660 KB | Output is correct |
49 | Correct | 60 ms | 780 KB | Output is correct |