답안 #535373

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
535373 2022-03-10T06:36:16 Z pokmui9909 기지국 (IOI20_stations) C++17
100 / 100
860 ms 820 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

vector<int> num;
ll cnt = 0;
vector<ll> G[1005];
void DFS(ll u, ll p){
    if(p == -1 || !num[p]) num[u] = ++cnt;
    for(auto v : G[u]){
        if(v == p) continue;
        DFS(v, u);
    }
    if(!num[u]) num[u] = ++cnt;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    num.clear();
    num.resize(n);
    for(int i = 0; i < 1005; i++) G[i].clear();
    cnt = 0;
    for(int i = 0; i < n - 1; i++){
        G[u[i]].push_back(v[i]);
        G[v[i]].push_back(u[i]);
    }
    DFS(0, -1);
    return num;
}
int find_next_station(int s, int t, std::vector<int> c) {
    if(c.back() < s) reverse(c.begin(), c.end());
    for(auto v : c){
        if(min(s, v) <= t && t <= max(s, v)){
            return v;
        }
    }
    return c.back();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 449 ms 532 KB Output is correct
2 Correct 385 ms 540 KB Output is correct
3 Correct 777 ms 420 KB Output is correct
4 Correct 532 ms 524 KB Output is correct
5 Correct 500 ms 416 KB Output is correct
6 Correct 358 ms 548 KB Output is correct
7 Correct 344 ms 544 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 4 ms 492 KB Output is correct
10 Correct 0 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 405 ms 520 KB Output is correct
2 Correct 454 ms 520 KB Output is correct
3 Correct 725 ms 420 KB Output is correct
4 Correct 593 ms 420 KB Output is correct
5 Correct 557 ms 528 KB Output is correct
6 Correct 379 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 462 ms 544 KB Output is correct
2 Correct 392 ms 664 KB Output is correct
3 Correct 752 ms 420 KB Output is correct
4 Correct 561 ms 420 KB Output is correct
5 Correct 479 ms 516 KB Output is correct
6 Correct 413 ms 520 KB Output is correct
7 Correct 389 ms 544 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 512 ms 532 KB Output is correct
12 Correct 418 ms 624 KB Output is correct
13 Correct 399 ms 528 KB Output is correct
14 Correct 399 ms 548 KB Output is correct
15 Correct 48 ms 492 KB Output is correct
16 Correct 63 ms 528 KB Output is correct
17 Correct 95 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 726 ms 532 KB Output is correct
2 Correct 558 ms 532 KB Output is correct
3 Correct 559 ms 524 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Correct 4 ms 492 KB Output is correct
6 Correct 0 ms 492 KB Output is correct
7 Correct 493 ms 528 KB Output is correct
8 Correct 860 ms 416 KB Output is correct
9 Correct 622 ms 504 KB Output is correct
10 Correct 550 ms 416 KB Output is correct
11 Correct 4 ms 492 KB Output is correct
12 Correct 4 ms 492 KB Output is correct
13 Correct 6 ms 492 KB Output is correct
14 Correct 3 ms 488 KB Output is correct
15 Correct 2 ms 500 KB Output is correct
16 Correct 477 ms 416 KB Output is correct
17 Correct 432 ms 532 KB Output is correct
18 Correct 507 ms 464 KB Output is correct
19 Correct 433 ms 452 KB Output is correct
20 Correct 463 ms 524 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 419 ms 516 KB Output is correct
2 Correct 383 ms 536 KB Output is correct
3 Correct 745 ms 420 KB Output is correct
4 Correct 505 ms 420 KB Output is correct
5 Correct 512 ms 420 KB Output is correct
6 Correct 322 ms 524 KB Output is correct
7 Correct 349 ms 548 KB Output is correct
8 Correct 1 ms 492 KB Output is correct
9 Correct 3 ms 492 KB Output is correct
10 Correct 1 ms 500 KB Output is correct
11 Correct 371 ms 524 KB Output is correct
12 Correct 402 ms 524 KB Output is correct
13 Correct 725 ms 416 KB Output is correct
14 Correct 510 ms 556 KB Output is correct
15 Correct 481 ms 420 KB Output is correct
16 Correct 344 ms 528 KB Output is correct
17 Correct 465 ms 416 KB Output is correct
18 Correct 385 ms 644 KB Output is correct
19 Correct 376 ms 628 KB Output is correct
20 Correct 397 ms 540 KB Output is correct
21 Correct 52 ms 492 KB Output is correct
22 Correct 64 ms 600 KB Output is correct
23 Correct 82 ms 600 KB Output is correct
24 Correct 5 ms 492 KB Output is correct
25 Correct 2 ms 496 KB Output is correct
26 Correct 5 ms 492 KB Output is correct
27 Correct 2 ms 492 KB Output is correct
28 Correct 1 ms 492 KB Output is correct
29 Correct 381 ms 444 KB Output is correct
30 Correct 413 ms 656 KB Output is correct
31 Correct 409 ms 420 KB Output is correct
32 Correct 397 ms 532 KB Output is correct
33 Correct 349 ms 420 KB Output is correct
34 Correct 270 ms 604 KB Output is correct
35 Correct 388 ms 772 KB Output is correct
36 Correct 384 ms 760 KB Output is correct
37 Correct 377 ms 652 KB Output is correct
38 Correct 363 ms 652 KB Output is correct
39 Correct 347 ms 648 KB Output is correct
40 Correct 353 ms 652 KB Output is correct
41 Correct 357 ms 760 KB Output is correct
42 Correct 44 ms 676 KB Output is correct
43 Correct 88 ms 600 KB Output is correct
44 Correct 117 ms 656 KB Output is correct
45 Correct 140 ms 664 KB Output is correct
46 Correct 264 ms 676 KB Output is correct
47 Correct 215 ms 528 KB Output is correct
48 Correct 61 ms 820 KB Output is correct
49 Correct 51 ms 800 KB Output is correct