Submission #529603

# Submission time Handle Problem Language Result Execution time Memory
529603 2022-02-23T08:55:31 Z pokmui9909 Stations (IOI20_stations) C++17
52.3205 / 100
1019 ms 840 KB
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll in[1005], out[1005];
vector<ll> T[1005];
ll num = -1;
void dfs(ll u, ll p){
	in[u] = ++num;
	for(auto v : T[u]){
		if(v == p) continue;
		dfs(v, u);
	}
	out[u] = num;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
    num = -1;
    for(int i = 0; i < n; i++) T[i].clear();

	for(int i = 0; i < n - 1; i++){
		T[u[i]].push_back(v[i]);
		T[v[i]].push_back(u[i]);
	}
	dfs(0, -1);
	vector<int> L(n);
	for(int i = 0; i < n; i++){
		L[i] = in[i] * 1000 + out[i];
	}
	return L;
}
bool is_par(ll u, ll v){
    return (u / 1000 <= v / 1000 && v % 1000 <= u % 1000);
}
int find_next_station(int s, int t, std::vector<int> c) {
    if(is_par(s, t)){
        for(auto i : c){
            if(is_par(s, i) && is_par(i, t)){
                return i;
            }
        }
    } else if(is_par(t, s)){
        for(auto i : c){
            if(is_par(t, i) && is_par(i, s)){
                return i;
            }
        }
    } else {
        for(auto i : c){
            if(is_par(i, s)){
                return i;
            }
        }
    }
}

Compilation message

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
   55 | }
      | ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 424 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=6009
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 400 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1511
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 550 ms 532 KB Output is correct
2 Correct 499 ms 620 KB Output is correct
3 Correct 1019 ms 504 KB Output is correct
4 Correct 573 ms 512 KB Output is correct
5 Correct 447 ms 500 KB Output is correct
6 Correct 510 ms 488 KB Output is correct
7 Correct 429 ms 512 KB Output is correct
8 Correct 3 ms 576 KB Output is correct
9 Correct 5 ms 468 KB Output is correct
10 Correct 2 ms 588 KB Output is correct
11 Correct 568 ms 508 KB Output is correct
12 Correct 489 ms 612 KB Output is correct
13 Correct 442 ms 724 KB Output is correct
14 Correct 480 ms 508 KB Output is correct
15 Correct 58 ms 528 KB Output is correct
16 Correct 90 ms 656 KB Output is correct
17 Correct 86 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 998 ms 488 KB Output is correct
2 Correct 754 ms 500 KB Output is correct
3 Correct 570 ms 496 KB Output is correct
4 Correct 3 ms 596 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 603 ms 400 KB Output is correct
8 Correct 1000 ms 528 KB Output is correct
9 Correct 621 ms 508 KB Output is correct
10 Correct 516 ms 492 KB Output is correct
11 Correct 5 ms 468 KB Output is correct
12 Correct 6 ms 468 KB Output is correct
13 Correct 5 ms 468 KB Output is correct
14 Correct 6 ms 468 KB Output is correct
15 Correct 2 ms 560 KB Output is correct
16 Correct 635 ms 400 KB Output is correct
17 Correct 614 ms 516 KB Output is correct
18 Correct 469 ms 400 KB Output is correct
19 Correct 602 ms 508 KB Output is correct
20 Correct 394 ms 400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 603 ms 512 KB Partially correct
2 Partially correct 514 ms 608 KB Partially correct
3 Partially correct 909 ms 500 KB Partially correct
4 Partially correct 730 ms 508 KB Partially correct
5 Partially correct 671 ms 400 KB Partially correct
6 Partially correct 376 ms 504 KB Partially correct
7 Partially correct 433 ms 524 KB Partially correct
8 Partially correct 2 ms 560 KB Partially correct
9 Partially correct 3 ms 476 KB Partially correct
10 Partially correct 2 ms 472 KB Partially correct
11 Partially correct 509 ms 500 KB Partially correct
12 Partially correct 552 ms 508 KB Partially correct
13 Partially correct 885 ms 400 KB Partially correct
14 Partially correct 662 ms 516 KB Partially correct
15 Partially correct 696 ms 508 KB Partially correct
16 Partially correct 450 ms 488 KB Partially correct
17 Partially correct 614 ms 400 KB Partially correct
18 Partially correct 363 ms 612 KB Partially correct
19 Partially correct 465 ms 620 KB Partially correct
20 Partially correct 437 ms 512 KB Partially correct
21 Partially correct 62 ms 552 KB Partially correct
22 Partially correct 48 ms 788 KB Partially correct
23 Partially correct 105 ms 656 KB Partially correct
24 Partially correct 6 ms 468 KB Partially correct
25 Partially correct 5 ms 448 KB Partially correct
26 Partially correct 4 ms 476 KB Partially correct
27 Partially correct 3 ms 584 KB Partially correct
28 Partially correct 1 ms 476 KB Partially correct
29 Partially correct 416 ms 508 KB Partially correct
30 Partially correct 406 ms 528 KB Partially correct
31 Partially correct 421 ms 400 KB Partially correct
32 Partially correct 542 ms 496 KB Partially correct
33 Partially correct 432 ms 500 KB Partially correct
34 Partially correct 282 ms 504 KB Partially correct
35 Partially correct 363 ms 636 KB Partially correct
36 Partially correct 476 ms 632 KB Partially correct
37 Partially correct 450 ms 752 KB Partially correct
38 Partially correct 440 ms 740 KB Partially correct
39 Partially correct 456 ms 640 KB Partially correct
40 Partially correct 445 ms 632 KB Partially correct
41 Partially correct 467 ms 632 KB Partially correct
42 Partially correct 52 ms 528 KB Partially correct
43 Partially correct 111 ms 528 KB Partially correct
44 Partially correct 96 ms 732 KB Partially correct
45 Partially correct 168 ms 636 KB Partially correct
46 Partially correct 290 ms 636 KB Partially correct
47 Partially correct 254 ms 508 KB Partially correct
48 Partially correct 58 ms 788 KB Partially correct
49 Partially correct 56 ms 840 KB Partially correct