답안 #51202

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
51202 2018-06-17T08:19:23 Z 김세빈(#1291) 장난감 기차 (IOI17_train) C++11
11 / 100
1584 ms 27648 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(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;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 444 ms 25428 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 25428 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 291 ms 26148 KB Output is correct
2 Correct 311 ms 26148 KB Output is correct
3 Correct 312 ms 26156 KB Output is correct
4 Correct 1584 ms 26392 KB Output is correct
5 Correct 1067 ms 26392 KB Output is correct
6 Correct 826 ms 26392 KB Output is correct
7 Correct 922 ms 26392 KB Output is correct
8 Correct 405 ms 26392 KB Output is correct
9 Correct 359 ms 26392 KB Output is correct
10 Correct 549 ms 26392 KB Output is correct
11 Correct 433 ms 26392 KB Output is correct
12 Correct 76 ms 26392 KB Output is correct
13 Correct 1396 ms 26676 KB Output is correct
14 Correct 1414 ms 27056 KB Output is correct
15 Correct 1450 ms 27324 KB Output is correct
16 Correct 1330 ms 27372 KB Output is correct
17 Correct 1372 ms 27520 KB Output is correct
18 Correct 534 ms 27580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1315 ms 27628 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1388 ms 27648 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 444 ms 25428 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -