Submission #304909

# Submission time Handle Problem Language Result Execution time Memory
304909 2020-09-22T07:40:52 Z model_code Stations (IOI20_stations) C++17
76 / 100
1176 ms 1048 KB
#include "stations.h"
#include <algorithm>
#define MAXN 1000

int cnt;
std::vector<int> adj[MAXN], labels;

void dfs(int v, int p, int d) {
	if(!d) labels[v] = cnt;
	++cnt;
	for (int i : adj[v]) if (i != p) dfs(i, v, d ^ 1);
	if(d) labels[v] = cnt;
	++cnt;
}

std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
	cnt = 0;
	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]);
	}
	labels.resize(n);
	dfs(0, -1, 0);
	return labels;
}

int find_next_station(int s, int t, std::vector<int> c) {
	if (s < c[0]) {
		if (t < s || t >= c.back()) return c.back();
		return *std::lower_bound(c.begin(), c.end(), t);
	}
	if (t > s || t <= c[0]) return c[0];
	return *--std::upper_bound(c.begin(), c.end(), t);
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 508 KB Invalid labels (values out of range). scenario=2, k=1000, vertex=1, label=1990
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 484 KB Invalid labels (values out of range). scenario=0, k=1000, vertex=1, label=1022
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 704 ms 1024 KB Output is correct
2 Correct 630 ms 1024 KB Output is correct
3 Correct 1138 ms 908 KB Output is correct
4 Correct 784 ms 904 KB Output is correct
5 Correct 700 ms 760 KB Output is correct
6 Correct 584 ms 1024 KB Output is correct
7 Correct 554 ms 776 KB Output is correct
8 Correct 2 ms 768 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 0 ms 768 KB Output is correct
11 Correct 685 ms 1024 KB Output is correct
12 Correct 533 ms 1048 KB Output is correct
13 Correct 637 ms 1008 KB Output is correct
14 Correct 512 ms 904 KB Output is correct
15 Correct 53 ms 896 KB Output is correct
16 Correct 74 ms 768 KB Output is correct
17 Correct 127 ms 800 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 973 ms 896 KB Output is correct
2 Correct 685 ms 756 KB Output is correct
3 Correct 682 ms 640 KB Output is correct
4 Correct 2 ms 896 KB Output is correct
5 Correct 4 ms 768 KB Output is correct
6 Correct 0 ms 768 KB Output is correct
7 Correct 655 ms 768 KB Output is correct
8 Correct 1158 ms 1024 KB Output is correct
9 Correct 863 ms 768 KB Output is correct
10 Correct 809 ms 808 KB Output is correct
11 Correct 8 ms 768 KB Output is correct
12 Correct 7 ms 768 KB Output is correct
13 Correct 6 ms 800 KB Output is correct
14 Correct 4 ms 904 KB Output is correct
15 Correct 2 ms 660 KB Output is correct
16 Correct 565 ms 768 KB Output is correct
17 Correct 588 ms 832 KB Output is correct
18 Correct 693 ms 896 KB Output is correct
19 Correct 687 ms 768 KB Output is correct
20 Correct 622 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 708 ms 1032 KB Partially correct
2 Partially correct 576 ms 1032 KB Partially correct
3 Correct 1176 ms 760 KB Output is correct
4 Correct 734 ms 768 KB Output is correct
5 Correct 743 ms 768 KB Output is correct
6 Partially correct 636 ms 1016 KB Partially correct
7 Partially correct 602 ms 808 KB Partially correct
8 Correct 3 ms 768 KB Output is correct
9 Correct 4 ms 768 KB Output is correct
10 Correct 2 ms 768 KB Output is correct
11 Partially correct 523 ms 764 KB Partially correct
12 Partially correct 569 ms 904 KB Partially correct
13 Correct 1130 ms 760 KB Output is correct
14 Correct 864 ms 760 KB Output is correct
15 Correct 770 ms 768 KB Output is correct
16 Partially correct 466 ms 896 KB Partially correct
17 Correct 706 ms 816 KB Output is correct
18 Partially correct 579 ms 1024 KB Partially correct
19 Partially correct 668 ms 1008 KB Partially correct
20 Partially correct 496 ms 800 KB Partially correct
21 Correct 76 ms 828 KB Output is correct
22 Partially correct 102 ms 768 KB Partially correct
23 Partially correct 112 ms 780 KB Partially correct
24 Correct 4 ms 768 KB Output is correct
25 Correct 7 ms 768 KB Output is correct
26 Correct 5 ms 776 KB Output is correct
27 Correct 4 ms 768 KB Output is correct
28 Correct 2 ms 768 KB Output is correct
29 Correct 675 ms 776 KB Output is correct
30 Correct 579 ms 768 KB Output is correct
31 Correct 622 ms 768 KB Output is correct
32 Correct 509 ms 776 KB Output is correct
33 Correct 548 ms 896 KB Output is correct
34 Partially correct 327 ms 976 KB Partially correct
35 Partially correct 662 ms 1024 KB Partially correct
36 Partially correct 503 ms 1016 KB Partially correct
37 Partially correct 575 ms 988 KB Partially correct
38 Partially correct 479 ms 768 KB Partially correct
39 Partially correct 551 ms 960 KB Partially correct
40 Partially correct 529 ms 1016 KB Partially correct
41 Partially correct 607 ms 888 KB Partially correct
42 Partially correct 100 ms 864 KB Partially correct
43 Partially correct 127 ms 928 KB Partially correct
44 Partially correct 130 ms 896 KB Partially correct
45 Partially correct 204 ms 768 KB Partially correct
46 Partially correct 390 ms 780 KB Partially correct
47 Partially correct 353 ms 952 KB Partially correct
48 Partially correct 92 ms 768 KB Partially correct
49 Partially correct 77 ms 976 KB Partially correct