답안 #291012

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
291012 2020-09-04T15:30:23 Z Saboon 장난감 기차 (IOI17_train) C++17
11 / 100
1080 ms 1544 KB
// Subtask 3
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5000 + 10;
int n, m;

vector<int> g[maxn];
bool visited[maxn];

void dfs(int v){
	visited[v] = 1;
	for (auto u : g[v])
		if (!visited[u])
			dfs(u);
}

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n = a.size(), m = u.size();
	for (int i = 0; i < m; i++){
		g[v[i]].push_back(u[i]);
	}
	vector<int> dp(n);
	for (int i = 0; i < n; i++){
		dp[i] = 0;
		if (r[i]){
			memset(visited, 0, sizeof visited);
			dfs(i);
			for (int j = 0; j < m; j++)
				if (visited[v[j]] and u[j] == i)
					dp[i] = 1;
		}
	}
	for (int t = 0; t < n; t++)
		for (int i = 0; i < m; i++)
			dp[u[i]] |= dp[v[i]];
	return dp;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 283 ms 888 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB 3rd lines differ - on the 8th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 402 ms 1400 KB Output is correct
2 Correct 392 ms 1400 KB Output is correct
3 Correct 467 ms 1280 KB Output is correct
4 Correct 701 ms 1204 KB Output is correct
5 Correct 432 ms 1372 KB Output is correct
6 Correct 367 ms 1320 KB Output is correct
7 Correct 814 ms 1436 KB Output is correct
8 Correct 374 ms 1280 KB Output is correct
9 Correct 332 ms 1152 KB Output is correct
10 Correct 321 ms 1280 KB Output is correct
11 Correct 308 ms 1152 KB Output is correct
12 Correct 315 ms 1152 KB Output is correct
13 Correct 358 ms 1408 KB Output is correct
14 Correct 368 ms 1408 KB Output is correct
15 Correct 381 ms 1528 KB Output is correct
16 Correct 339 ms 1416 KB Output is correct
17 Correct 362 ms 1544 KB Output is correct
18 Correct 424 ms 1144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1080 ms 1044 KB 3rd lines differ - on the 696th token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 363 ms 1168 KB 3rd lines differ - on the 2nd token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 283 ms 888 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -