# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
815946 | 2023-08-09T02:49:08 Z | math_rabbit_1028 | 기지국 (IOI20_stations) | C++14 | 725 ms | 888 KB |
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[1010]; int ch[1010], ord[2020], lt[1010], rt[1010], dep[1010]; int r = -1; void DFS(int v) { if (dep[v] % 2 == 0) { ord[++r] = v; lt[v] = r; } for (int i = 0; i < adj[v].size(); i++) { int next = adj[v][i]; if (ch[next]) continue; ch[next] = 1; dep[next] = dep[v] + 1; DFS(next); } if (dep[v] % 2 == 1) { ord[++r] = v; rt[v] = r; } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < n; i++) adj[i].clear(); for (int i = 0; i < n - 1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } for (int i = 0; i < n; i++) ch[i] = 0; ch[0] = 1; dep[0] = 0; r = -1; DFS(0); vector<int> lab(n); for (int i = 0; i < n; i++) { if (dep[i] % 2 == 0) lab[i] = lt[i]; else lab[i] = rt[i]; } //for (int i = 0; i < n; i++) cout << lab[i] << " "; //cout << "\n"; return lab; } int find_next_station(int s, int t, vector<int> c) { if (s < c[0]) { for (int i = 0; i < c.size(); i++) { int l = ((i == 0) ? s : c[i - 1]), r = c[i]; if (l < t && t <= r) return c[i]; } return c[c.size() - 1]; } if (s > c[c.size() - 1]) { for (int i = c.size() - 1; i >= 0; i--) { int l = c[i], r = ((i == c.size() - 1) ? s : c[i + 1]); if (l <= t && t < r) return c[i]; } return c[0]; } assert(false); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 447 ms | 672 KB | Output is correct |
2 | Correct | 331 ms | 832 KB | Output is correct |
3 | Correct | 620 ms | 548 KB | Output is correct |
4 | Correct | 518 ms | 536 KB | Output is correct |
5 | Correct | 435 ms | 548 KB | Output is correct |
6 | Correct | 357 ms | 804 KB | Output is correct |
7 | Correct | 286 ms | 564 KB | Output is correct |
8 | Correct | 1 ms | 628 KB | Output is correct |
9 | Correct | 2 ms | 620 KB | Output is correct |
10 | Correct | 0 ms | 620 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 373 ms | 544 KB | Output is correct |
2 | Correct | 373 ms | 536 KB | Output is correct |
3 | Correct | 630 ms | 524 KB | Output is correct |
4 | Correct | 464 ms | 612 KB | Output is correct |
5 | Correct | 454 ms | 532 KB | Output is correct |
6 | Correct | 330 ms | 580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 429 ms | 676 KB | Output is correct |
2 | Correct | 393 ms | 656 KB | Output is correct |
3 | Correct | 649 ms | 668 KB | Output is correct |
4 | Correct | 658 ms | 532 KB | Output is correct |
5 | Correct | 422 ms | 544 KB | Output is correct |
6 | Correct | 377 ms | 672 KB | Output is correct |
7 | Correct | 304 ms | 544 KB | Output is correct |
8 | Correct | 1 ms | 620 KB | Output is correct |
9 | Correct | 5 ms | 628 KB | Output is correct |
10 | Correct | 0 ms | 620 KB | Output is correct |
11 | Correct | 420 ms | 544 KB | Output is correct |
12 | Correct | 373 ms | 728 KB | Output is correct |
13 | Correct | 318 ms | 764 KB | Output is correct |
14 | Correct | 274 ms | 532 KB | Output is correct |
15 | Correct | 44 ms | 584 KB | Output is correct |
16 | Correct | 48 ms | 728 KB | Output is correct |
17 | Correct | 60 ms | 660 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 606 ms | 544 KB | Output is correct |
2 | Correct | 467 ms | 536 KB | Output is correct |
3 | Correct | 513 ms | 548 KB | Output is correct |
4 | Correct | 1 ms | 628 KB | Output is correct |
5 | Correct | 3 ms | 632 KB | Output is correct |
6 | Correct | 0 ms | 632 KB | Output is correct |
7 | Correct | 564 ms | 532 KB | Output is correct |
8 | Correct | 677 ms | 548 KB | Output is correct |
9 | Correct | 485 ms | 544 KB | Output is correct |
10 | Correct | 427 ms | 544 KB | Output is correct |
11 | Correct | 3 ms | 628 KB | Output is correct |
12 | Correct | 4 ms | 616 KB | Output is correct |
13 | Correct | 1 ms | 620 KB | Output is correct |
14 | Correct | 2 ms | 620 KB | Output is correct |
15 | Correct | 1 ms | 620 KB | Output is correct |
16 | Correct | 352 ms | 540 KB | Output is correct |
17 | Correct | 321 ms | 532 KB | Output is correct |
18 | Correct | 394 ms | 564 KB | Output is correct |
19 | Correct | 286 ms | 532 KB | Output is correct |
20 | Correct | 288 ms | 536 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 340 ms | 680 KB | Output is correct |
2 | Correct | 407 ms | 664 KB | Output is correct |
3 | Correct | 597 ms | 532 KB | Output is correct |
4 | Correct | 513 ms | 548 KB | Output is correct |
5 | Correct | 430 ms | 544 KB | Output is correct |
6 | Correct | 405 ms | 648 KB | Output is correct |
7 | Correct | 310 ms | 544 KB | Output is correct |
8 | Correct | 1 ms | 620 KB | Output is correct |
9 | Correct | 2 ms | 620 KB | Output is correct |
10 | Correct | 0 ms | 620 KB | Output is correct |
11 | Correct | 391 ms | 532 KB | Output is correct |
12 | Correct | 384 ms | 588 KB | Output is correct |
13 | Correct | 725 ms | 528 KB | Output is correct |
14 | Correct | 584 ms | 544 KB | Output is correct |
15 | Correct | 411 ms | 548 KB | Output is correct |
16 | Correct | 429 ms | 544 KB | Output is correct |
17 | Correct | 509 ms | 536 KB | Output is correct |
18 | Correct | 350 ms | 796 KB | Output is correct |
19 | Correct | 315 ms | 780 KB | Output is correct |
20 | Correct | 306 ms | 544 KB | Output is correct |
21 | Correct | 32 ms | 620 KB | Output is correct |
22 | Correct | 42 ms | 600 KB | Output is correct |
23 | Correct | 79 ms | 584 KB | Output is correct |
24 | Correct | 3 ms | 628 KB | Output is correct |
25 | Correct | 5 ms | 616 KB | Output is correct |
26 | Correct | 3 ms | 620 KB | Output is correct |
27 | Correct | 3 ms | 620 KB | Output is correct |
28 | Correct | 0 ms | 620 KB | Output is correct |
29 | Correct | 514 ms | 544 KB | Output is correct |
30 | Correct | 377 ms | 544 KB | Output is correct |
31 | Correct | 437 ms | 672 KB | Output is correct |
32 | Correct | 405 ms | 544 KB | Output is correct |
33 | Correct | 470 ms | 536 KB | Output is correct |
34 | Correct | 270 ms | 652 KB | Output is correct |
35 | Correct | 314 ms | 724 KB | Output is correct |
36 | Correct | 376 ms | 660 KB | Output is correct |
37 | Correct | 323 ms | 656 KB | Output is correct |
38 | Correct | 341 ms | 664 KB | Output is correct |
39 | Correct | 403 ms | 672 KB | Output is correct |
40 | Correct | 404 ms | 664 KB | Output is correct |
41 | Correct | 454 ms | 656 KB | Output is correct |
42 | Correct | 48 ms | 572 KB | Output is correct |
43 | Correct | 94 ms | 664 KB | Output is correct |
44 | Correct | 95 ms | 568 KB | Output is correct |
45 | Correct | 124 ms | 724 KB | Output is correct |
46 | Correct | 313 ms | 544 KB | Output is correct |
47 | Correct | 310 ms | 544 KB | Output is correct |
48 | Correct | 76 ms | 704 KB | Output is correct |
49 | Correct | 41 ms | 888 KB | Output is correct |