Submission #51201

# Submission time Handle Problem Language Result Execution time Memory
51201 2018-06-17T08:18:08 Z 김세빈(#1291) Toy Train (IOI17_train) C++11
0 / 100
1536 ms 26368 KB
#include "train.h"

using namespace std;

vector <int> V[5050];
int chk[5050];
bool R[5050][5050], c[5050];
int n,m;

void dfs(int p,int x)
{
	R[x-1][p] = 1;
	chk[p] = x;
	
	for(auto t: V[p]) if(chk[t] != x){
		dfs(t,x);
	}
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v)
{
	vector <int> res(a.size());
	int i,j;
	
	n = a.size();
	m = u.size();
	
	for(i=0;i<m;i++){
		V[u[i]].push_back(v[i]);
	}
	
	for(i=0;i<n;i++){
		for(auto t: V[i]) dfs(t,i+1);
	}
	
	for(i=0;i<n;i++) if(r[i]){
		for(j=0;j<n;j++) if(i != j){
			if(R[i][j] && R[j][i]) c[i] = 1;
		}
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			if(c[j] && R[i][j]) res[i] = 1;
		}
	}
	
	return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 371 ms 25292 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 25292 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 306 ms 26036 KB Output is correct
2 Correct 300 ms 26100 KB Output is correct
3 Correct 336 ms 26340 KB Output is correct
4 Correct 1536 ms 26348 KB Output is correct
5 Correct 1081 ms 26348 KB Output is correct
6 Correct 742 ms 26368 KB Output is correct
7 Correct 874 ms 26368 KB Output is correct
8 Correct 453 ms 26368 KB Output is correct
9 Correct 398 ms 26368 KB Output is correct
10 Correct 554 ms 26368 KB Output is correct
11 Incorrect 448 ms 26368 KB 3rd lines differ - on the 89th token, expected: '1', found: '0'
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1353 ms 26368 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 1397 ms 26368 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 371 ms 25292 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -