Submission #53440

# Submission time Handle Problem Language Result Execution time Memory
53440 2018-06-30T02:56:07 Z ainta Toy Train (IOI17_train) C++17
11 / 100
1898 ms 1136 KB
#include "train.h"
#include<cstdio>
#include<algorithm>
using namespace std;

int n, m, D[5010], TD[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] = 0;
		else D[i] = -1e9;
		if (a[i] == 1)TD[i] = -1e9;
		else TD[i] = 1e9;
	}
	for (i = 0; i <=n+n; i++) {
		for (j = 0; j < m; j++) {
			int t = D[v[j]] + 1;
			if (r[u[j]])t = max(t, 0);
			if (a[u[j]] == 1) {
				TD[u[j]] = max(TD[u[j]], t);
			}
			else {
				TD[u[j]] = min(TD[u[j]], t);
			}
		}
		for (j = 0; j < n; j++) {
			D[j] = TD[j];
			if (a[j] == 1)TD[j] = -1e9;
			else TD[j] = 1e9;
		}
	}
	vector<int>res(n);
	for (j = 0; j < n; j++) {
		if (D[j] >= n)res[j] = 1;
		else res[j] = 0;
	}
	return res;
}

Compilation message

train.cpp: In function 'std::vector<int> who_wins(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
train.cpp:11:12: warning: unused variable 'k' [-Wunused-variable]
  int i, j, k;
            ^
# Verdict Execution time Memory Grader output
1 Incorrect 932 ms 552 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 552 KB Output is correct
2 Correct 2 ms 572 KB Output is correct
3 Correct 2 ms 572 KB Output is correct
4 Incorrect 3 ms 572 KB 3rd lines differ - on the 4th token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 597 ms 912 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 655 ms 912 KB Output is correct
2 Correct 766 ms 924 KB Output is correct
3 Correct 874 ms 1052 KB Output is correct
4 Correct 1790 ms 1052 KB Output is correct
5 Correct 784 ms 1052 KB Output is correct
6 Correct 831 ms 1104 KB Output is correct
7 Correct 916 ms 1132 KB Output is correct
8 Correct 1173 ms 1132 KB Output is correct
9 Correct 790 ms 1132 KB Output is correct
10 Correct 1372 ms 1132 KB Output is correct
11 Correct 897 ms 1132 KB Output is correct
12 Correct 1331 ms 1132 KB Output is correct
13 Correct 764 ms 1132 KB Output is correct
14 Correct 693 ms 1132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1308 ms 1136 KB Output is correct
2 Correct 1068 ms 1136 KB Output is correct
3 Correct 1898 ms 1136 KB Output is correct
4 Correct 1644 ms 1136 KB Output is correct
5 Correct 5 ms 1136 KB Output is correct
6 Correct 761 ms 1136 KB Output is correct
7 Correct 168 ms 1136 KB Output is correct
8 Incorrect 159 ms 1136 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 932 ms 552 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -