Submission #51199

# Submission time Handle Problem Language Result Execution time Memory
51199 2018-06-17T08:15:18 Z 김세빈(#1291) Toy Train (IOI17_train) C++11
0 / 100
1466 ms 28880 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++){
		dfs(i,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 401 ms 25336 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 3 ms 25336 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 259 ms 26544 KB Output is correct
2 Correct 278 ms 26824 KB Output is correct
3 Correct 296 ms 26912 KB Output is correct
4 Correct 1466 ms 27216 KB Output is correct
5 Correct 1053 ms 27540 KB Output is correct
6 Correct 795 ms 27540 KB Output is correct
7 Correct 918 ms 27704 KB Output is correct
8 Correct 480 ms 27884 KB Output is correct
9 Correct 376 ms 28112 KB Output is correct
10 Correct 514 ms 28292 KB Output is correct
11 Incorrect 452 ms 28480 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 1266 ms 28544 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 1359 ms 28880 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 401 ms 25336 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -