답안 #258099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
258099 2020-08-05T11:02:51 Z dsjong 장난감 기차 (IOI17_train) C++14
11 / 100
1459 ms 1784 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
bool vis[5005], cycle[5005];
vector<int>adj[5005];
bool una=true;
void dfs(int x){
	if(!una) vis[x]=true;
	una=false;
	for(int y:adj[x]){
		if(!vis[y]) dfs(y);
	}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v){
	int n=a.size(), m=u.size();
	for(int i=0;i<m;i++){
		adj[u[i]].push_back(v[i]);
	}
	for(int i=0;i<n;i++){
		if(r[i]==1){
			memset(vis, false, sizeof vis);
			una=true;
			dfs(i);
			if(vis[i]) cycle[i]=true;
		}
	}
	vector<int>ans;
	for(int i=0;i<n;i++){
		una=false;
		memset(vis, false, sizeof vis);
		dfs(i);
		bool good=false;
		for(int i=0;i<n;i++){
			if(r[i] && vis[i] && cycle[i]) good=true;
		}
		if(good) ans.push_back(1);
		else ans.push_back(0);
	}
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 379 ms 1272 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 512 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 193 ms 1528 KB Output is correct
2 Correct 230 ms 1656 KB Output is correct
3 Correct 272 ms 1408 KB Output is correct
4 Correct 1230 ms 1784 KB Output is correct
5 Correct 763 ms 1528 KB Output is correct
6 Correct 569 ms 1400 KB Output is correct
7 Correct 757 ms 1280 KB Output is correct
8 Correct 278 ms 1400 KB Output is correct
9 Correct 250 ms 1272 KB Output is correct
10 Correct 342 ms 1400 KB Output is correct
11 Correct 295 ms 1248 KB Output is correct
12 Correct 50 ms 1272 KB Output is correct
13 Correct 1008 ms 1556 KB Output is correct
14 Correct 986 ms 1528 KB Output is correct
15 Correct 948 ms 1528 KB Output is correct
16 Correct 973 ms 1408 KB Output is correct
17 Correct 946 ms 1528 KB Output is correct
18 Correct 541 ms 1144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1459 ms 1272 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1010 ms 1424 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 379 ms 1272 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -