Submission #33762

# Submission time Handle Problem Language Result Execution time Memory
33762 2017-11-01T14:23:58 Z mohammad_kilani Toy Train (IOI17_train) C++14
0 / 100
1623 ms 5596 KB
#include <bits/stdc++.h>
#include "train.h"
using namespace std;
const int N = 5010;
bitset < N > win[N]; 


std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	vector<int> ans;
	int n = a.size();
	for(int i=0;i<n;i++) win[i][0] = r[i] ; 
	for(int j=1;j<=n;j++){
		for(int i=0;i<n;i++) if(r[i]) win[i][j] = 1; else win[i][j] = a[i] ^ 1;
		for(int i=0;i<u.size();i++){
			int o = u[i];
			int t = v[i];
			if(r[o]) continue;
			if(a[o]){
				if(win[t][j-1]) win[o][j] = 1;
			}
			else{
				if(win[t][j-1] == 0) win[o][j] = 0;
			}
		}
	}
	for(int i=0;i<n;i++) ans.push_back(win[i][n]);
	return ans;
}

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:14:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<u.size();i++){
                ^
# Verdict Execution time Memory Grader output
1 Incorrect 683 ms 5388 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 0 ms 5112 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 443 ms 5596 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 256 ms 5460 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 Correct 1623 ms 5596 KB Output is correct
2 Correct 823 ms 5596 KB Output is correct
3 Correct 1519 ms 5596 KB Output is correct
4 Correct 1036 ms 5572 KB Output is correct
5 Correct 0 ms 5112 KB Output is correct
6 Incorrect 519 ms 5384 KB 3rd lines differ - on the 3730th token, expected: '0', found: '1'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 683 ms 5388 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -