Submission #39107

# Submission time Handle Problem Language Result Execution time Memory
39107 2018-01-09T10:56:27 Z mohammad_kilani Toy Train (IOI17_train) C++14
0 / 100
2000 ms 8552 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 5010;
bitset < N > win[2][N];
int n , m;

std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	n = a.size();
	m = u.size();
	vector<int> res;
	for(int i=0;i<n;i++) win[0][0][i] = r[i];
	for(int i=1;i<=n;i++){
		for(int j=0;j<n;j++) win[0][i][j] = (r[j] == 1 ? 1 : (a[j] ^ 1));
		for(int j=0;j<m;j++){
			if(r[u[j]]) continue;
			if(a[u[j]]){
				if(win[0][i-1][v[j]] == 1) win[0][i][u[j]] = 1;
			}
			else{
				if(win[0][i-1][v[j]] == 0) win[0][i][u[j]] = 0;	
			}
		}
	}
	for(int i=0;i<n;i++) win[1][0][i] = win[0][n][i];
	for(int i=1;i<=m;i++){
		for(int j=0;j<n;j++) win[1][i][j] = win[1][i-1][j];
		for(int j=0;j<m;j++){
			if(a[u[j]]){
				if(win[1][i-1][v[j]] == 1) win[1][i][u[j]] = 1;
			}
			else{
				if(win[1][i-1][v[j]] == 0) win[1][i][u[j]] = 0;	
			}
		}
	}
	for(int i=0;i<n;i++) res.push_back(win[1][m][i]);
	return res;
}
# Verdict Execution time Memory Grader output
1 Runtime error 836 ms 8344 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 8204 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 Runtime error 799 ms 8552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 446 ms 8552 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2000 ms 8552 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 836 ms 8344 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -