Submission #53438

# Submission time Handle Problem Language Result Execution time Memory
53438 2018-06-30T02:43:22 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 < 10003; 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 == 5002)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 709 ms 632 KB Output is correct
2 Correct 674 ms 636 KB Output is correct
3 Correct 664 ms 832 KB Output is correct
4 Correct 666 ms 832 KB Output is correct
5 Correct 665 ms 832 KB Output is correct
6 Correct 755 ms 884 KB Output is correct
7 Correct 419 ms 888 KB Output is correct
8 Correct 349 ms 888 KB Output is correct
9 Correct 691 ms 948 KB Output is correct
10 Correct 605 ms 948 KB Output is correct
11 Correct 541 ms 948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 948 KB Output is correct
2 Correct 3 ms 948 KB Output is correct
3 Correct 3 ms 948 KB Output is correct
4 Correct 4 ms 948 KB Output is correct
5 Correct 3 ms 948 KB Output is correct
6 Correct 3 ms 948 KB Output is correct
7 Correct 4 ms 948 KB Output is correct
8 Correct 4 ms 948 KB Output is correct
9 Correct 5 ms 948 KB Output is correct
10 Correct 3 ms 948 KB Output is correct
11 Correct 4 ms 948 KB Output is correct
12 Correct 4 ms 948 KB Output is correct
13 Correct 3 ms 948 KB Output is correct
14 Correct 2 ms 948 KB Output is correct
15 Correct 3 ms 948 KB Output is correct
16 Correct 3 ms 948 KB Output is correct
17 Correct 3 ms 948 KB Output is correct
18 Correct 4 ms 948 KB Output is correct
19 Correct 4 ms 948 KB Output is correct
20 Correct 3 ms 948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 539 ms 1064 KB Output is correct
2 Correct 537 ms 1172 KB Output is correct
3 Correct 550 ms 1172 KB Output is correct
4 Correct 740 ms 1172 KB Output is correct
5 Correct 896 ms 1264 KB Output is correct
6 Correct 780 ms 1264 KB Output is correct
7 Correct 741 ms 1264 KB Output is correct
8 Correct 876 ms 1284 KB Output is correct
9 Correct 757 ms 1284 KB Output is correct
10 Correct 708 ms 1284 KB Output is correct
11 Correct 673 ms 1284 KB Output is correct
12 Correct 647 ms 1284 KB Output is correct
13 Correct 821 ms 1284 KB Output is correct
14 Correct 793 ms 1284 KB Output is correct
15 Correct 780 ms 1284 KB Output is correct
16 Correct 784 ms 1284 KB Output is correct
17 Correct 809 ms 1284 KB Output is correct
18 Correct 407 ms 1284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 580 ms 1284 KB Output is correct
2 Correct 699 ms 1284 KB Output is correct
3 Correct 749 ms 1340 KB Output is correct
4 Correct 833 ms 1340 KB Output is correct
5 Correct 715 ms 1340 KB Output is correct
6 Correct 692 ms 1340 KB Output is correct
7 Correct 722 ms 1340 KB Output is correct
8 Correct 678 ms 1340 KB Output is correct
9 Correct 665 ms 1340 KB Output is correct
10 Correct 767 ms 1340 KB Output is correct
11 Correct 815 ms 1340 KB Output is correct
12 Correct 775 ms 1340 KB Output is correct
13 Correct 747 ms 1340 KB Output is correct
14 Correct 708 ms 1340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1212 ms 1340 KB Output is correct
2 Correct 1209 ms 1340 KB Output is correct
3 Correct 1847 ms 1340 KB Output is correct
4 Correct 1599 ms 1340 KB Output is correct
5 Correct 44 ms 1340 KB Output is correct
6 Correct 656 ms 1340 KB Output is correct
7 Correct 1182 ms 1340 KB Output is correct
8 Correct 1385 ms 1340 KB Output is correct
9 Correct 1395 ms 1340 KB Output is correct
10 Correct 271 ms 1340 KB Output is correct
11 Correct 1122 ms 1340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 709 ms 632 KB Output is correct
2 Correct 674 ms 636 KB Output is correct
3 Correct 664 ms 832 KB Output is correct
4 Correct 666 ms 832 KB Output is correct
5 Correct 665 ms 832 KB Output is correct
6 Correct 755 ms 884 KB Output is correct
7 Correct 419 ms 888 KB Output is correct
8 Correct 349 ms 888 KB Output is correct
9 Correct 691 ms 948 KB Output is correct
10 Correct 605 ms 948 KB Output is correct
11 Correct 541 ms 948 KB Output is correct
12 Correct 3 ms 948 KB Output is correct
13 Correct 3 ms 948 KB Output is correct
14 Correct 3 ms 948 KB Output is correct
15 Correct 4 ms 948 KB Output is correct
16 Correct 3 ms 948 KB Output is correct
17 Correct 3 ms 948 KB Output is correct
18 Correct 4 ms 948 KB Output is correct
19 Correct 4 ms 948 KB Output is correct
20 Correct 5 ms 948 KB Output is correct
21 Correct 3 ms 948 KB Output is correct
22 Correct 4 ms 948 KB Output is correct
23 Correct 4 ms 948 KB Output is correct
24 Correct 3 ms 948 KB Output is correct
25 Correct 2 ms 948 KB Output is correct
26 Correct 3 ms 948 KB Output is correct
27 Correct 3 ms 948 KB Output is correct
28 Correct 3 ms 948 KB Output is correct
29 Correct 4 ms 948 KB Output is correct
30 Correct 4 ms 948 KB Output is correct
31 Correct 3 ms 948 KB Output is correct
32 Correct 539 ms 1064 KB Output is correct
33 Correct 537 ms 1172 KB Output is correct
34 Correct 550 ms 1172 KB Output is correct
35 Correct 740 ms 1172 KB Output is correct
36 Correct 896 ms 1264 KB Output is correct
37 Correct 780 ms 1264 KB Output is correct
38 Correct 741 ms 1264 KB Output is correct
39 Correct 876 ms 1284 KB Output is correct
40 Correct 757 ms 1284 KB Output is correct
41 Correct 708 ms 1284 KB Output is correct
42 Correct 673 ms 1284 KB Output is correct
43 Correct 647 ms 1284 KB Output is correct
44 Correct 821 ms 1284 KB Output is correct
45 Correct 793 ms 1284 KB Output is correct
46 Correct 780 ms 1284 KB Output is correct
47 Correct 784 ms 1284 KB Output is correct
48 Correct 809 ms 1284 KB Output is correct
49 Correct 407 ms 1284 KB Output is correct
50 Correct 580 ms 1284 KB Output is correct
51 Correct 699 ms 1284 KB Output is correct
52 Correct 749 ms 1340 KB Output is correct
53 Correct 833 ms 1340 KB Output is correct
54 Correct 715 ms 1340 KB Output is correct
55 Correct 692 ms 1340 KB Output is correct
56 Correct 722 ms 1340 KB Output is correct
57 Correct 678 ms 1340 KB Output is correct
58 Correct 665 ms 1340 KB Output is correct
59 Correct 767 ms 1340 KB Output is correct
60 Correct 815 ms 1340 KB Output is correct
61 Correct 775 ms 1340 KB Output is correct
62 Correct 747 ms 1340 KB Output is correct
63 Correct 708 ms 1340 KB Output is correct
64 Correct 1212 ms 1340 KB Output is correct
65 Correct 1209 ms 1340 KB Output is correct
66 Correct 1847 ms 1340 KB Output is correct
67 Correct 1599 ms 1340 KB Output is correct
68 Correct 44 ms 1340 KB Output is correct
69 Correct 656 ms 1340 KB Output is correct
70 Correct 1182 ms 1340 KB Output is correct
71 Correct 1385 ms 1340 KB Output is correct
72 Correct 1395 ms 1340 KB Output is correct
73 Correct 271 ms 1340 KB Output is correct
74 Correct 1122 ms 1340 KB Output is correct
75 Correct 493 ms 1340 KB Output is correct
76 Correct 661 ms 1340 KB Output is correct
77 Correct 699 ms 1340 KB Output is correct
78 Correct 685 ms 1340 KB Output is correct
79 Correct 702 ms 1340 KB Output is correct
80 Correct 1714 ms 1340 KB Output is correct
81 Correct 1847 ms 1340 KB Output is correct
82 Correct 1518 ms 1340 KB Output is correct
83 Correct 878 ms 1340 KB Output is correct
84 Correct 1008 ms 1340 KB Output is correct
85 Correct 916 ms 1340 KB Output is correct
86 Correct 854 ms 1340 KB Output is correct
87 Correct 830 ms 1340 KB Output is correct
88 Execution timed out 2045 ms 1340 KB Time limit exceeded
89 Halted 0 ms 0 KB -