Submission #53436

# Submission time Handle Problem Language Result Execution time Memory
53436 2018-06-30T02:38:26 Z ainta Toy Train (IOI17_train) C++17
0 / 100
2000 ms 1424 KB
#include "train.h"
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;

int n, m, D[5010], TD[5010], U[5010], chk[5010];
vector<int>E[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 < m; i++) {
		E[u[i]].push_back(v[i]);
	}
	for (i = 0; i < n; i++) {
		if (r[i] == 1)TD[i] = 1;
		else TD[i] = 0;
		D[i] = -1;
	}
	for (i = 0; i < 15000; i++) {
		for (j = 0; j < n; j++) {
			if (D[j] != TD[j]) chk[j] = 1, D[j]=TD[j];
			else chk[j] = 0;
			if (a[j])TD[j] = 0;
			else TD[j] = 1e9;
		}
		for (j = 0; j < n; j++) {
			if (chk[j]) {
				for (auto &t : E[j]) {
					if (a[t] == 1) {
						TD[t] = max(TD[t], r[t] + D[j]);
					}
					else {
						TD[t] = min(TD[t], r[t] + D[j]);
					}
				}
			}
		}
		if (i == 9999)for (j = 0; j < n; j++)U[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 Incorrect 1778 ms 1016 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 1016 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 Incorrect 649 ms 1276 KB 3rd lines differ - on the 5th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1476 ms 1280 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2072 ms 1424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1778 ms 1016 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -