Submission #33691

# Submission time Handle Problem Language Result Execution time Memory
33691 2017-10-31T17:52:05 Z mohammad_kilani Toy Train (IOI17_train) C++14
0 / 100
669 ms 5996 KB
#include <bits/stdc++.h>
#include "train.h"
using namespace std;
const int N = 5010;

bitset< N > win[N] ;
vector<int> g[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 i=0;i<u.size();i++) g[u[i]].push_back(v[i]);
	for(int j=1;j<=n;j++){
		for(int i=0;i<n;i++){
			win[i][j] = a[i] ^ 1;
			for(int k=0;k<g[i].size();k++){
				if(a[i]){
					if(win[g[i][k]][j-1]) win[i][j] = 1;
				}
				else{
					if(win[g[i][k]][j-1] == 0) win[i][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:13:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]);
               ^
train.cpp:17:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int k=0;k<g[i].size();k++){
                 ^
# Verdict Execution time Memory Grader output
1 Incorrect 393 ms 5632 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 5228 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 586 ms 5996 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 516 ms 5852 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 669 ms 5976 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 393 ms 5632 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -