Submission #51200

# Submission time Handle Problem Language Result Execution time Memory
51200 2018-06-17T08:16:44 Z 김세빈(#1291) Toy Train (IOI17_train) C++11
0 / 100
1525 ms 26332 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;
	
	for(auto t: V[p]) if(chk[t] != x){
		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 352 ms 25208 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 25208 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 288 ms 26048 KB Output is correct
2 Correct 293 ms 26108 KB Output is correct
3 Correct 318 ms 26124 KB Output is correct
4 Correct 1525 ms 26332 KB Output is correct
5 Correct 1052 ms 26332 KB Output is correct
6 Correct 750 ms 26332 KB Output is correct
7 Correct 945 ms 26332 KB Output is correct
8 Correct 466 ms 26332 KB Output is correct
9 Correct 413 ms 26332 KB Output is correct
10 Correct 550 ms 26332 KB Output is correct
11 Incorrect 438 ms 26332 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 1389 ms 26332 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 1400 ms 26332 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 352 ms 25208 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -