답안 #53435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
53435 2018-06-30T02:30:06 Z ainta 장난감 기차 (IOI17_train) C++17
37 / 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;
	for (i = 0; i < n; i++) {
		if (r[i] == 1)D[i] = 1;
		else D[i] = 0;
		if (a[i] == 1)TD[i] = 0;
		else TD[i] = 1e9;
	}
	for (i = 0; i < 15000; i++) {
		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]]);
			}
		}
		if (i == 9999) {
			for (j = 0; j < n; j++)U[j] = TD[j];
		}
		for (j = 0; j < n; j++) {
			D[j] = TD[j];
			if (a[j] == 1)TD[j] = 0;
			else TD[j] = 1e9;
		}
	}
	vector<int>res(n);
	for (j = 0; j < n; j++) {
		if (D[j] != U[j])res[j] = 1;
		else res[j] = 0;
	}
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1120 ms 632 KB Output is correct
2 Correct 1103 ms 744 KB Output is correct
3 Correct 1182 ms 844 KB Output is correct
4 Correct 1112 ms 844 KB Output is correct
5 Correct 1135 ms 844 KB Output is correct
6 Correct 1073 ms 872 KB Output is correct
7 Correct 451 ms 904 KB Output is correct
8 Correct 439 ms 904 KB Output is correct
9 Correct 1069 ms 904 KB Output is correct
10 Correct 1072 ms 988 KB Output is correct
11 Correct 905 ms 988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 988 KB Output is correct
2 Correct 2 ms 988 KB Output is correct
3 Correct 4 ms 988 KB Output is correct
4 Correct 5 ms 988 KB Output is correct
5 Correct 3 ms 988 KB Output is correct
6 Correct 5 ms 988 KB Output is correct
7 Correct 3 ms 988 KB Output is correct
8 Correct 7 ms 988 KB Output is correct
9 Correct 7 ms 988 KB Output is correct
10 Correct 4 ms 988 KB Output is correct
11 Correct 6 ms 988 KB Output is correct
12 Correct 5 ms 988 KB Output is correct
13 Correct 4 ms 988 KB Output is correct
14 Correct 3 ms 988 KB Output is correct
15 Correct 3 ms 988 KB Output is correct
16 Correct 3 ms 988 KB Output is correct
17 Correct 3 ms 988 KB Output is correct
18 Correct 3 ms 988 KB Output is correct
19 Correct 3 ms 988 KB Output is correct
20 Correct 3 ms 988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 890 ms 1104 KB Output is correct
2 Correct 915 ms 1164 KB Output is correct
3 Correct 846 ms 1212 KB Output is correct
4 Correct 1195 ms 1212 KB Output is correct
5 Correct 1130 ms 1212 KB Output is correct
6 Correct 1242 ms 1212 KB Output is correct
7 Correct 1107 ms 1212 KB Output is correct
8 Correct 1124 ms 1308 KB Output is correct
9 Correct 953 ms 1308 KB Output is correct
10 Correct 1047 ms 1308 KB Output is correct
11 Correct 1056 ms 1308 KB Output is correct
12 Correct 992 ms 1308 KB Output is correct
13 Correct 1205 ms 1308 KB Output is correct
14 Correct 1129 ms 1308 KB Output is correct
15 Correct 1097 ms 1308 KB Output is correct
16 Correct 1197 ms 1308 KB Output is correct
17 Correct 1113 ms 1308 KB Output is correct
18 Correct 658 ms 1308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 943 ms 1308 KB Output is correct
2 Correct 1037 ms 1308 KB Output is correct
3 Correct 1105 ms 1308 KB Output is correct
4 Correct 1099 ms 1308 KB Output is correct
5 Correct 1059 ms 1308 KB Output is correct
6 Correct 1031 ms 1340 KB Output is correct
7 Correct 1046 ms 1340 KB Output is correct
8 Correct 1012 ms 1340 KB Output is correct
9 Correct 975 ms 1340 KB Output is correct
10 Correct 1107 ms 1340 KB Output is correct
11 Correct 1097 ms 1340 KB Output is correct
12 Correct 1145 ms 1340 KB Output is correct
13 Correct 1123 ms 1340 KB Output is correct
14 Correct 1012 ms 1340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2020 ms 1340 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1120 ms 632 KB Output is correct
2 Correct 1103 ms 744 KB Output is correct
3 Correct 1182 ms 844 KB Output is correct
4 Correct 1112 ms 844 KB Output is correct
5 Correct 1135 ms 844 KB Output is correct
6 Correct 1073 ms 872 KB Output is correct
7 Correct 451 ms 904 KB Output is correct
8 Correct 439 ms 904 KB Output is correct
9 Correct 1069 ms 904 KB Output is correct
10 Correct 1072 ms 988 KB Output is correct
11 Correct 905 ms 988 KB Output is correct
12 Correct 6 ms 988 KB Output is correct
13 Correct 2 ms 988 KB Output is correct
14 Correct 4 ms 988 KB Output is correct
15 Correct 5 ms 988 KB Output is correct
16 Correct 3 ms 988 KB Output is correct
17 Correct 5 ms 988 KB Output is correct
18 Correct 3 ms 988 KB Output is correct
19 Correct 7 ms 988 KB Output is correct
20 Correct 7 ms 988 KB Output is correct
21 Correct 4 ms 988 KB Output is correct
22 Correct 6 ms 988 KB Output is correct
23 Correct 5 ms 988 KB Output is correct
24 Correct 4 ms 988 KB Output is correct
25 Correct 3 ms 988 KB Output is correct
26 Correct 3 ms 988 KB Output is correct
27 Correct 3 ms 988 KB Output is correct
28 Correct 3 ms 988 KB Output is correct
29 Correct 3 ms 988 KB Output is correct
30 Correct 3 ms 988 KB Output is correct
31 Correct 3 ms 988 KB Output is correct
32 Correct 890 ms 1104 KB Output is correct
33 Correct 915 ms 1164 KB Output is correct
34 Correct 846 ms 1212 KB Output is correct
35 Correct 1195 ms 1212 KB Output is correct
36 Correct 1130 ms 1212 KB Output is correct
37 Correct 1242 ms 1212 KB Output is correct
38 Correct 1107 ms 1212 KB Output is correct
39 Correct 1124 ms 1308 KB Output is correct
40 Correct 953 ms 1308 KB Output is correct
41 Correct 1047 ms 1308 KB Output is correct
42 Correct 1056 ms 1308 KB Output is correct
43 Correct 992 ms 1308 KB Output is correct
44 Correct 1205 ms 1308 KB Output is correct
45 Correct 1129 ms 1308 KB Output is correct
46 Correct 1097 ms 1308 KB Output is correct
47 Correct 1197 ms 1308 KB Output is correct
48 Correct 1113 ms 1308 KB Output is correct
49 Correct 658 ms 1308 KB Output is correct
50 Correct 943 ms 1308 KB Output is correct
51 Correct 1037 ms 1308 KB Output is correct
52 Correct 1105 ms 1308 KB Output is correct
53 Correct 1099 ms 1308 KB Output is correct
54 Correct 1059 ms 1308 KB Output is correct
55 Correct 1031 ms 1340 KB Output is correct
56 Correct 1046 ms 1340 KB Output is correct
57 Correct 1012 ms 1340 KB Output is correct
58 Correct 975 ms 1340 KB Output is correct
59 Correct 1107 ms 1340 KB Output is correct
60 Correct 1097 ms 1340 KB Output is correct
61 Correct 1145 ms 1340 KB Output is correct
62 Correct 1123 ms 1340 KB Output is correct
63 Correct 1012 ms 1340 KB Output is correct
64 Execution timed out 2020 ms 1340 KB Time limit exceeded
65 Halted 0 ms 0 KB -