Submission #98888

# Submission time Handle Problem Language Result Execution time Memory
98888 2019-02-27T05:41:58 Z square1001 Toy Train (IOI17_train) C++14
0 / 100
2000 ms 1024 KB
#include "train.h"
#include <vector>
#include <algorithm>
using namespace std;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	int n = a.size(), m = u.size();
	vector<vector<int> > g(n);
	for(int i = 0; i < m; ++i) {
		g[u[i]].push_back(v[i]);
	}
	vector<int> dp(n, n);
	for(int i = 0; i < n * n; ++i) {
		vector<int> ndp(n);
		for(int j = 0; j < n; ++j) {
			if(a[j] == 1) {
				ndp[j] = 0;
				for(int k : g[j]) {
					ndp[j] = max(ndp[j], dp[k]);
				}
			}
			else {
				ndp[j] = n;
				for(int k : g[j]) {
					ndp[j] = min(ndp[j], dp[k] > 0 ? dp[k] - 1 : 0);
				}
			}
			if(r[j] == 1 && ndp[j] > 0) {
				ndp[j] = n;
			}
		}
		dp = ndp;
	}
	vector<int> ans(n);
	for(int i = 0; i < n; ++i) {
		ans[i] = (dp[i] > 0 ? 1 : 0);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Execution timed out 2055 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 256 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 Execution timed out 2099 ms 1024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2082 ms 1024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2068 ms 1024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2055 ms 768 KB Time limit exceeded
2 Halted 0 ms 0 KB -