Submission #53432

# Submission time Handle Problem Language Result Execution time Memory
53432 2018-06-30T02:25:59 Z ainta Toy Train (IOI17_train) C++17
49 / 100
1967 ms 1344 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 < 10000; 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 == 5001)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 697 ms 552 KB Output is correct
2 Correct 665 ms 868 KB Output is correct
3 Correct 664 ms 868 KB Output is correct
4 Correct 699 ms 868 KB Output is correct
5 Correct 710 ms 868 KB Output is correct
6 Correct 745 ms 868 KB Output is correct
7 Correct 343 ms 868 KB Output is correct
8 Correct 317 ms 868 KB Output is correct
9 Correct 649 ms 868 KB Output is correct
10 Correct 608 ms 868 KB Output is correct
11 Correct 506 ms 868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 868 KB Output is correct
2 Correct 3 ms 868 KB Output is correct
3 Correct 4 ms 868 KB Output is correct
4 Correct 4 ms 868 KB Output is correct
5 Correct 2 ms 868 KB Output is correct
6 Correct 3 ms 868 KB Output is correct
7 Correct 3 ms 868 KB Output is correct
8 Correct 3 ms 868 KB Output is correct
9 Correct 4 ms 868 KB Output is correct
10 Correct 4 ms 868 KB Output is correct
11 Correct 4 ms 868 KB Output is correct
12 Correct 4 ms 868 KB Output is correct
13 Correct 2 ms 868 KB Output is correct
14 Correct 2 ms 868 KB Output is correct
15 Correct 3 ms 868 KB Output is correct
16 Correct 3 ms 868 KB Output is correct
17 Correct 2 ms 868 KB Output is correct
18 Correct 4 ms 868 KB Output is correct
19 Correct 3 ms 868 KB Output is correct
20 Correct 2 ms 868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 634 ms 1116 KB Output is correct
2 Correct 522 ms 1124 KB Output is correct
3 Correct 519 ms 1124 KB Output is correct
4 Correct 733 ms 1124 KB Output is correct
5 Correct 780 ms 1124 KB Output is correct
6 Correct 725 ms 1124 KB Output is correct
7 Correct 791 ms 1124 KB Output is correct
8 Correct 775 ms 1124 KB Output is correct
9 Correct 604 ms 1124 KB Output is correct
10 Correct 677 ms 1124 KB Output is correct
11 Correct 661 ms 1124 KB Output is correct
12 Correct 637 ms 1124 KB Output is correct
13 Correct 736 ms 1124 KB Output is correct
14 Correct 755 ms 1124 KB Output is correct
15 Correct 750 ms 1124 KB Output is correct
16 Correct 730 ms 1124 KB Output is correct
17 Correct 793 ms 1124 KB Output is correct
18 Correct 453 ms 1124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 607 ms 1124 KB Output is correct
2 Correct 657 ms 1124 KB Output is correct
3 Correct 744 ms 1212 KB Output is correct
4 Correct 831 ms 1212 KB Output is correct
5 Correct 712 ms 1212 KB Output is correct
6 Correct 750 ms 1212 KB Output is correct
7 Correct 717 ms 1212 KB Output is correct
8 Correct 676 ms 1212 KB Output is correct
9 Correct 755 ms 1212 KB Output is correct
10 Correct 785 ms 1212 KB Output is correct
11 Correct 793 ms 1212 KB Output is correct
12 Correct 759 ms 1212 KB Output is correct
13 Correct 740 ms 1212 KB Output is correct
14 Correct 667 ms 1212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1209 ms 1344 KB Output is correct
2 Correct 1131 ms 1344 KB Output is correct
3 Correct 1815 ms 1344 KB Output is correct
4 Correct 1539 ms 1344 KB Output is correct
5 Correct 44 ms 1344 KB Output is correct
6 Correct 630 ms 1344 KB Output is correct
7 Correct 1126 ms 1344 KB Output is correct
8 Correct 1366 ms 1344 KB Output is correct
9 Correct 1394 ms 1344 KB Output is correct
10 Correct 225 ms 1344 KB Output is correct
11 Correct 977 ms 1344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 697 ms 552 KB Output is correct
2 Correct 665 ms 868 KB Output is correct
3 Correct 664 ms 868 KB Output is correct
4 Correct 699 ms 868 KB Output is correct
5 Correct 710 ms 868 KB Output is correct
6 Correct 745 ms 868 KB Output is correct
7 Correct 343 ms 868 KB Output is correct
8 Correct 317 ms 868 KB Output is correct
9 Correct 649 ms 868 KB Output is correct
10 Correct 608 ms 868 KB Output is correct
11 Correct 506 ms 868 KB Output is correct
12 Correct 4 ms 868 KB Output is correct
13 Correct 3 ms 868 KB Output is correct
14 Correct 4 ms 868 KB Output is correct
15 Correct 4 ms 868 KB Output is correct
16 Correct 2 ms 868 KB Output is correct
17 Correct 3 ms 868 KB Output is correct
18 Correct 3 ms 868 KB Output is correct
19 Correct 3 ms 868 KB Output is correct
20 Correct 4 ms 868 KB Output is correct
21 Correct 4 ms 868 KB Output is correct
22 Correct 4 ms 868 KB Output is correct
23 Correct 4 ms 868 KB Output is correct
24 Correct 2 ms 868 KB Output is correct
25 Correct 2 ms 868 KB Output is correct
26 Correct 3 ms 868 KB Output is correct
27 Correct 3 ms 868 KB Output is correct
28 Correct 2 ms 868 KB Output is correct
29 Correct 4 ms 868 KB Output is correct
30 Correct 3 ms 868 KB Output is correct
31 Correct 2 ms 868 KB Output is correct
32 Correct 634 ms 1116 KB Output is correct
33 Correct 522 ms 1124 KB Output is correct
34 Correct 519 ms 1124 KB Output is correct
35 Correct 733 ms 1124 KB Output is correct
36 Correct 780 ms 1124 KB Output is correct
37 Correct 725 ms 1124 KB Output is correct
38 Correct 791 ms 1124 KB Output is correct
39 Correct 775 ms 1124 KB Output is correct
40 Correct 604 ms 1124 KB Output is correct
41 Correct 677 ms 1124 KB Output is correct
42 Correct 661 ms 1124 KB Output is correct
43 Correct 637 ms 1124 KB Output is correct
44 Correct 736 ms 1124 KB Output is correct
45 Correct 755 ms 1124 KB Output is correct
46 Correct 750 ms 1124 KB Output is correct
47 Correct 730 ms 1124 KB Output is correct
48 Correct 793 ms 1124 KB Output is correct
49 Correct 453 ms 1124 KB Output is correct
50 Correct 607 ms 1124 KB Output is correct
51 Correct 657 ms 1124 KB Output is correct
52 Correct 744 ms 1212 KB Output is correct
53 Correct 831 ms 1212 KB Output is correct
54 Correct 712 ms 1212 KB Output is correct
55 Correct 750 ms 1212 KB Output is correct
56 Correct 717 ms 1212 KB Output is correct
57 Correct 676 ms 1212 KB Output is correct
58 Correct 755 ms 1212 KB Output is correct
59 Correct 785 ms 1212 KB Output is correct
60 Correct 793 ms 1212 KB Output is correct
61 Correct 759 ms 1212 KB Output is correct
62 Correct 740 ms 1212 KB Output is correct
63 Correct 667 ms 1212 KB Output is correct
64 Correct 1209 ms 1344 KB Output is correct
65 Correct 1131 ms 1344 KB Output is correct
66 Correct 1815 ms 1344 KB Output is correct
67 Correct 1539 ms 1344 KB Output is correct
68 Correct 44 ms 1344 KB Output is correct
69 Correct 630 ms 1344 KB Output is correct
70 Correct 1126 ms 1344 KB Output is correct
71 Correct 1366 ms 1344 KB Output is correct
72 Correct 1394 ms 1344 KB Output is correct
73 Correct 225 ms 1344 KB Output is correct
74 Correct 977 ms 1344 KB Output is correct
75 Correct 449 ms 1344 KB Output is correct
76 Correct 648 ms 1344 KB Output is correct
77 Correct 671 ms 1344 KB Output is correct
78 Correct 672 ms 1344 KB Output is correct
79 Correct 667 ms 1344 KB Output is correct
80 Correct 1605 ms 1344 KB Output is correct
81 Correct 1785 ms 1344 KB Output is correct
82 Correct 1478 ms 1344 KB Output is correct
83 Correct 841 ms 1344 KB Output is correct
84 Correct 899 ms 1344 KB Output is correct
85 Correct 884 ms 1344 KB Output is correct
86 Correct 806 ms 1344 KB Output is correct
87 Correct 816 ms 1344 KB Output is correct
88 Correct 1967 ms 1344 KB Output is correct
89 Correct 957 ms 1344 KB Output is correct
90 Correct 1879 ms 1344 KB Output is correct
91 Correct 879 ms 1344 KB Output is correct
92 Correct 1156 ms 1344 KB Output is correct
93 Correct 1107 ms 1344 KB Output is correct
94 Correct 1827 ms 1344 KB Output is correct
95 Correct 1737 ms 1344 KB Output is correct
96 Incorrect 947 ms 1344 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
97 Halted 0 ms 0 KB -