Submission #282329

# Submission time Handle Problem Language Result Execution time Memory
282329 2020-08-24T10:05:47 Z MohamedAhmed04 Toy Train (IOI17_train) C++14
0 / 100
8 ms 1152 KB
#include <bits/stdc++.h>
#include "train.h"
//#include "grader.cpp"

using namespace std ;

const int MAX = 5010 ;

int A[MAX] , R[MAX] ;
vector< vector<int> >adj(MAX) ;
int n , m ;

int vis[MAX] , mark[MAX] , Ans[MAX] ;

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[u[i]].push_back(v[i]) ;
	vector<int>ans ;
	for(int i = n-1 ; i >= 0 ; --i)
	{
		A[i] = a[i] , R[i] = r[i] ;
		Ans[i] = 0 ;
		for(auto &child : adj[i])
		{
			if(child == i)
			{
				if(R[i] == A[i])
					Ans[i] = 1 ;
			}
			else if(child == i+1)
			{
				if(A[i] && A[i+1] == Ans[i+1])
					Ans[i] = 1 ;
				if(!A[i] && A[i+1] != Ans[i+1])
					Ans[i] = 1 ;
			}
		}
		if(R[i])
			Ans[i] = A[i] ;
	}
	for(int i = 0 ; i < n ; ++i)
		ans.push_back(Ans[i] == A[i]) ;
	return ans ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 896 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 384 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 7 ms 1152 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 7 ms 1056 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 8 ms 1152 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 4 ms 896 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -