Submission #53437

# Submission time Handle Problem Language Result Execution time Memory
53437 2018-06-30T02:41:36 Z ainta Toy Train (IOI17_train) C++17
49 / 100
2000 ms 1340 KB
#include "train.h"
#include<cstdio>
#include<algorithm>
using namespace std;
 
int n, m, D[5010], TD[5010], U[5010];
 
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size();
	m = u.size();
	int i, j, k;
	for (i = 0; i < n; i++) {
		if (r[i] == 1)D[i] = 1;
		else D[i] = 0;
	}
	for (i = 0; i < 10100; i++) {
		for (k = 0; k < n; k++) {
			if (a[k] == 1)TD[k] = 0;
			else TD[k] = 1e9;
		}
		for (j = 0; j < m; j++) {
			if (a[u[j]] == 1) {
				TD[u[j]] = max(TD[u[j]], r[u[j]] + D[v[j]]);
			}
			else {
				TD[u[j]] = min(TD[u[j]], r[u[j]] + D[v[j]]);
			}
		}
		for (j = 0; j < n; j++) {
			if (i == 5099)U[j] = TD[j];
			D[j] = TD[j];
		}
	}
	vector<int>res(n);
	for (j = 0; j < n; j++) {
		if (D[j] != U[j])res[j] = 1;
		else res[j] = 0;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 691 ms 504 KB Output is correct
2 Correct 732 ms 744 KB Output is correct
3 Correct 748 ms 744 KB Output is correct
4 Correct 759 ms 744 KB Output is correct
5 Correct 750 ms 828 KB Output is correct
6 Correct 800 ms 884 KB Output is correct
7 Correct 378 ms 884 KB Output is correct
8 Correct 333 ms 884 KB Output is correct
9 Correct 737 ms 884 KB Output is correct
10 Correct 624 ms 884 KB Output is correct
11 Correct 519 ms 936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 936 KB Output is correct
2 Correct 2 ms 936 KB Output is correct
3 Correct 3 ms 936 KB Output is correct
4 Correct 4 ms 936 KB Output is correct
5 Correct 2 ms 936 KB Output is correct
6 Correct 3 ms 936 KB Output is correct
7 Correct 3 ms 936 KB Output is correct
8 Correct 4 ms 936 KB Output is correct
9 Correct 4 ms 936 KB Output is correct
10 Correct 3 ms 936 KB Output is correct
11 Correct 4 ms 936 KB Output is correct
12 Correct 4 ms 936 KB Output is correct
13 Correct 2 ms 936 KB Output is correct
14 Correct 2 ms 936 KB Output is correct
15 Correct 2 ms 936 KB Output is correct
16 Correct 2 ms 936 KB Output is correct
17 Correct 3 ms 936 KB Output is correct
18 Correct 3 ms 936 KB Output is correct
19 Correct 3 ms 936 KB Output is correct
20 Correct 3 ms 936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 569 ms 1104 KB Output is correct
2 Correct 536 ms 1196 KB Output is correct
3 Correct 519 ms 1196 KB Output is correct
4 Correct 738 ms 1196 KB Output is correct
5 Correct 763 ms 1196 KB Output is correct
6 Correct 799 ms 1196 KB Output is correct
7 Correct 767 ms 1196 KB Output is correct
8 Correct 745 ms 1212 KB Output is correct
9 Correct 628 ms 1212 KB Output is correct
10 Correct 706 ms 1212 KB Output is correct
11 Correct 681 ms 1212 KB Output is correct
12 Correct 659 ms 1212 KB Output is correct
13 Correct 760 ms 1212 KB Output is correct
14 Correct 771 ms 1212 KB Output is correct
15 Correct 757 ms 1324 KB Output is correct
16 Correct 782 ms 1324 KB Output is correct
17 Correct 761 ms 1324 KB Output is correct
18 Correct 431 ms 1324 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 785 ms 1324 KB Output is correct
2 Correct 701 ms 1324 KB Output is correct
3 Correct 811 ms 1324 KB Output is correct
4 Correct 777 ms 1324 KB Output is correct
5 Correct 733 ms 1324 KB Output is correct
6 Correct 952 ms 1324 KB Output is correct
7 Correct 975 ms 1324 KB Output is correct
8 Correct 802 ms 1324 KB Output is correct
9 Correct 808 ms 1324 KB Output is correct
10 Correct 880 ms 1340 KB Output is correct
11 Correct 824 ms 1340 KB Output is correct
12 Correct 779 ms 1340 KB Output is correct
13 Correct 769 ms 1340 KB Output is correct
14 Correct 686 ms 1340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1180 ms 1340 KB Output is correct
2 Correct 1057 ms 1340 KB Output is correct
3 Correct 1788 ms 1340 KB Output is correct
4 Correct 1684 ms 1340 KB Output is correct
5 Correct 56 ms 1340 KB Output is correct
6 Correct 650 ms 1340 KB Output is correct
7 Correct 1111 ms 1340 KB Output is correct
8 Correct 1404 ms 1340 KB Output is correct
9 Correct 1337 ms 1340 KB Output is correct
10 Correct 235 ms 1340 KB Output is correct
11 Correct 947 ms 1340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 691 ms 504 KB Output is correct
2 Correct 732 ms 744 KB Output is correct
3 Correct 748 ms 744 KB Output is correct
4 Correct 759 ms 744 KB Output is correct
5 Correct 750 ms 828 KB Output is correct
6 Correct 800 ms 884 KB Output is correct
7 Correct 378 ms 884 KB Output is correct
8 Correct 333 ms 884 KB Output is correct
9 Correct 737 ms 884 KB Output is correct
10 Correct 624 ms 884 KB Output is correct
11 Correct 519 ms 936 KB Output is correct
12 Correct 3 ms 936 KB Output is correct
13 Correct 2 ms 936 KB Output is correct
14 Correct 3 ms 936 KB Output is correct
15 Correct 4 ms 936 KB Output is correct
16 Correct 2 ms 936 KB Output is correct
17 Correct 3 ms 936 KB Output is correct
18 Correct 3 ms 936 KB Output is correct
19 Correct 4 ms 936 KB Output is correct
20 Correct 4 ms 936 KB Output is correct
21 Correct 3 ms 936 KB Output is correct
22 Correct 4 ms 936 KB Output is correct
23 Correct 4 ms 936 KB Output is correct
24 Correct 2 ms 936 KB Output is correct
25 Correct 2 ms 936 KB Output is correct
26 Correct 2 ms 936 KB Output is correct
27 Correct 2 ms 936 KB Output is correct
28 Correct 3 ms 936 KB Output is correct
29 Correct 3 ms 936 KB Output is correct
30 Correct 3 ms 936 KB Output is correct
31 Correct 3 ms 936 KB Output is correct
32 Correct 569 ms 1104 KB Output is correct
33 Correct 536 ms 1196 KB Output is correct
34 Correct 519 ms 1196 KB Output is correct
35 Correct 738 ms 1196 KB Output is correct
36 Correct 763 ms 1196 KB Output is correct
37 Correct 799 ms 1196 KB Output is correct
38 Correct 767 ms 1196 KB Output is correct
39 Correct 745 ms 1212 KB Output is correct
40 Correct 628 ms 1212 KB Output is correct
41 Correct 706 ms 1212 KB Output is correct
42 Correct 681 ms 1212 KB Output is correct
43 Correct 659 ms 1212 KB Output is correct
44 Correct 760 ms 1212 KB Output is correct
45 Correct 771 ms 1212 KB Output is correct
46 Correct 757 ms 1324 KB Output is correct
47 Correct 782 ms 1324 KB Output is correct
48 Correct 761 ms 1324 KB Output is correct
49 Correct 431 ms 1324 KB Output is correct
50 Correct 785 ms 1324 KB Output is correct
51 Correct 701 ms 1324 KB Output is correct
52 Correct 811 ms 1324 KB Output is correct
53 Correct 777 ms 1324 KB Output is correct
54 Correct 733 ms 1324 KB Output is correct
55 Correct 952 ms 1324 KB Output is correct
56 Correct 975 ms 1324 KB Output is correct
57 Correct 802 ms 1324 KB Output is correct
58 Correct 808 ms 1324 KB Output is correct
59 Correct 880 ms 1340 KB Output is correct
60 Correct 824 ms 1340 KB Output is correct
61 Correct 779 ms 1340 KB Output is correct
62 Correct 769 ms 1340 KB Output is correct
63 Correct 686 ms 1340 KB Output is correct
64 Correct 1180 ms 1340 KB Output is correct
65 Correct 1057 ms 1340 KB Output is correct
66 Correct 1788 ms 1340 KB Output is correct
67 Correct 1684 ms 1340 KB Output is correct
68 Correct 56 ms 1340 KB Output is correct
69 Correct 650 ms 1340 KB Output is correct
70 Correct 1111 ms 1340 KB Output is correct
71 Correct 1404 ms 1340 KB Output is correct
72 Correct 1337 ms 1340 KB Output is correct
73 Correct 235 ms 1340 KB Output is correct
74 Correct 947 ms 1340 KB Output is correct
75 Correct 472 ms 1340 KB Output is correct
76 Correct 687 ms 1340 KB Output is correct
77 Correct 690 ms 1340 KB Output is correct
78 Correct 697 ms 1340 KB Output is correct
79 Correct 708 ms 1340 KB Output is correct
80 Correct 1646 ms 1340 KB Output is correct
81 Correct 1858 ms 1340 KB Output is correct
82 Correct 1602 ms 1340 KB Output is correct
83 Correct 873 ms 1340 KB Output is correct
84 Correct 973 ms 1340 KB Output is correct
85 Correct 948 ms 1340 KB Output is correct
86 Correct 877 ms 1340 KB Output is correct
87 Correct 850 ms 1340 KB Output is correct
88 Execution timed out 2003 ms 1340 KB Time limit exceeded
89 Halted 0 ms 0 KB -