Submission #33760

# Submission time Handle Problem Language Result Execution time Memory
33760 2017-11-01T14:04:00 Z mohammad_kilani Toy Train (IOI17_train) C++14
0 / 100
2000 ms 8688 KB
#include <bits/stdc++.h>
#include "train.h"
using namespace std;
const int N = 5010;
bitset < N > win[N] , win2[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++) if(win[i][n] == 0) win2[i][0] = 0; else win2[i][0] = 1;
	for(int j=1;j<=n;j++){
		for(int i=0;i<n;i++) if(win[i][n] == 0) win2[i][j] = 0; else win2[i][j] = a[i] ^ 1;
		for(int i=0;i<u.size();i++){
			int o = u[i];
			int t = v[i];
			if(a[o]){
				if(win2[t][j-1]) win2[o][j] = 1;
			}
			else{
				if(win2[t][j-1] == 0) win2[o][j] = 0;
			}
		}

	}
	for(int i=0;i<n;i++) ans.push_back(win2[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++){
                ^
train.cpp:29: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 1409 ms 8480 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 Correct 0 ms 8204 KB Output is correct
2 Correct 0 ms 8204 KB Output is correct
3 Correct 0 ms 8204 KB Output is correct
4 Incorrect 0 ms 8204 KB 3rd lines differ - on the 4th token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1022 ms 8688 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 Correct 786 ms 8552 KB Output is correct
2 Correct 1416 ms 8660 KB Output is correct
3 Execution timed out 2000 ms 8688 KB Execution timed out
4 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 Incorrect 1409 ms 8480 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -