답안 #406810

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
406810 2021-05-18T05:25:09 Z 8e7 장난감 기차 (IOI17_train) C++14
0 / 100
1709 ms 1700 KB
#include "train.h"

//Challenge: Accepted
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define ll long long
#define maxn 5005
#define pii pair<int, int>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
vector<int> adj[maxn], rev[maxn];
bool found[maxn], fr[maxn];
bool poss[maxn];
void dfs(int n, bool f[], vector<int> ed[]) {
	f[n] = 1;
	for (int v:ed[n]) {
		if (!f[v]) dfs(v, f, ed);
	}	
}
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
	int n = a.size(), m = u.size();
	for (int i = 0;i < m;i++) {
		adj[u[i]].push_back(v[i]);
		rev[v[i]].push_back(u[i]);
	}
	for (int i = 0;i < n;i++) {
		if (r[i] == 1) {
			for (int j = 0;j < n;j++) found[j] = fr[j] = 0;
			dfs(i, found, adj), dfs(i, fr, rev);
			for (int j = 0;j < n;j++) poss[j] |= found[j] && fr[j];	
		}
	}	
	vector<int> ret;
	for (int i = 0;i < n;i++) {
		if (poss[i]) ret.push_back(1);
		else ret.push_back(0);
	}
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 248 ms 1224 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 460 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 55 ms 1700 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1709 ms 1372 KB 3rd lines differ - on the 21st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 10 ms 1612 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 248 ms 1224 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -