Submission #282328

# Submission time Handle Problem Language Result Execution time Memory
282328 2020-08-24T10:05:32 Z MohamedAhmed04 Toy Train (IOI17_train) C++14
Compilation error
0 ms 0 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 ;
}

Compilation message

/tmp/ccZbZh6P.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccwkSW2a.o:train.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status