답안 #789996

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
789996 2023-07-22T08:48:04 Z Sohsoh84 장난감 기차 (IOI17_train) C++17
11 / 100
238 ms 24844 KB
#include "train.h"
#include <bits/stdc++.h>

using namespace std;

#define all(x)		(x).begin(), (x).end()
#define sep		' '
#define debug(x)	cerr << #x << ": " << x << endl;

const int MAXN = 1e6 + 10;

int n, m, col[MAXN];
bool A[MAXN], R[MAXN];
vector<int> adj[MAXN];
bool W[MAXN];

void dfs(int v) {
	col[v] = 1;
	if (R[v]) {
		col[v] = 2;
		return;
	}

	for (int u : adj[v]) {
		if (col[u] == 1) W[v] = 1;
		else if (col[u] == 0) dfs(u);
	}

	col[v] = 2;
}

vector<int> who_wins(vector<int> a_, vector<int> r_, vector<int> u_, vector<int> v_) {
	n = a_.size();
	for (int i = 0; i < n; i++)
		A[i] = a_[i], R[i] = r_[i];
	
	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 (!col[i])
			dfs(i);
	
	for (int i = 0; i < n; i++)
		for (int j = 0; j < n; j++)
			for (int u : adj[j])
				W[j] |= W[u];
	

	vector<int> res;
	for (int i = 0; i < n; i++)
		res.push_back(!W[i]);
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 24308 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 23796 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 109 ms 24844 KB Output is correct
2 Correct 129 ms 24712 KB Output is correct
3 Correct 121 ms 24728 KB Output is correct
4 Incorrect 171 ms 24728 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 24464 KB Output is correct
2 Correct 200 ms 24540 KB Output is correct
3 Correct 206 ms 24640 KB Output is correct
4 Correct 238 ms 24632 KB Output is correct
5 Correct 229 ms 24636 KB Output is correct
6 Correct 216 ms 24640 KB Output is correct
7 Correct 225 ms 24612 KB Output is correct
8 Correct 222 ms 24652 KB Output is correct
9 Correct 216 ms 24532 KB Output is correct
10 Correct 199 ms 24636 KB Output is correct
11 Correct 203 ms 24688 KB Output is correct
12 Correct 199 ms 24688 KB Output is correct
13 Correct 212 ms 24660 KB Output is correct
14 Correct 207 ms 24604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 209 ms 24772 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 24308 KB 3rd lines differ - on the 14th token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -