Submission #426985

# Submission time Handle Problem Language Result Execution time Memory
426985 2021-06-14T11:35:47 Z someone Toy Train (IOI17_train) C++14
0 / 100
2000 ms 1360 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 1e4 + 42;

bool ch[N];
int n, m, val[N][2];
vector<int> adj[N];

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size();
	m = u.size();
	for(int i = 0; i < m; i++)
		adj[v[i]].push_back(u[i]);
	for(int i = 0; i < 3*n; i++) {
		for(int j = 0; j < n; j++)
			if(r[j] == 1)
				val[j][i % 2] = max(n, val[j][i % 2]);
		for(int j = 0; j < n; j++)
			val[j][1 - (i % 2)] = 0;
		for(int j = 0; j < n; j++) {
			for(int k : adj[j]) {
				val[k][1 - (i % 2)] = max(val[k][1 - (i % 2)], val[j][i % 2] - 1);
			}
		}
	}
	int i = 3*n;
	if(r[i] == 1)
		val[i][i % 2] += n;
	for(int j = 0; j < n; j++)
		val[j][1 - (i % 2)] = 0;
	for(int j = 0; j < n; j++)
		for(int k : adj[j])
			if(val[k][1 - (i % 2)] < val[j][i % 2] - 1)
				ch[k] = true;
	vector<int> res(n);
	for(int i = 0; i < n; i++)
		if(ch[i])
			res[i] = 1;
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1283 ms 976 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 1 ms 460 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2048 ms 1320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1612 ms 1220 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1906 ms 1360 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1283 ms 976 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -