답안 #1037525

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1037525 2024-07-29T02:58:42 Z thinknoexit 장난감 기차 (IOI17_train) C++17
5 / 100
4 ms 1372 KB
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 5050;
vector<int> adj[N];
int n, m;
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++) {
		adj[_U[i]].push_back(_V[i]);
	}
	vector<int> ans(n);
	ans[n - 1] = r[n - 1];
	for (int i = n - 2;i >= 0;i--) {
		if (a[i] == 0) { // Borzou
			bool ch = 0;
			for (auto& x : adj[i]) {
				if (x == i && !r[i]) ch = 1;
				else if (x != i && !ans[x]) ch = 1;
			}
			ans[i] = ch ^ 1;
		}
		else { // Arezou
			bool ch = 0;
			for (auto& x : adj[i]) {
				if (x == i && r[i]) ch = 1;
				else if (x != i && ans[x]) ch = 1;
			}
			ans[i] = ch;
		}
	}
	return ans;
}
/*
4 5
1 0 1 1
0 0 0 1
0 1
1 1
1 2
2 3
3 3
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 856 KB Output is correct
2 Correct 2 ms 860 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Correct 3 ms 856 KB Output is correct
5 Correct 2 ms 860 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 2 ms 860 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 2 ms 860 KB Output is correct
11 Correct 2 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 1368 KB Output is correct
2 Correct 3 ms 1216 KB Output is correct
3 Correct 4 ms 1372 KB Output is correct
4 Incorrect 4 ms 1372 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1116 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 4 ms 1372 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 856 KB Output is correct
2 Correct 2 ms 860 KB Output is correct
3 Correct 2 ms 860 KB Output is correct
4 Correct 3 ms 856 KB Output is correct
5 Correct 2 ms 860 KB Output is correct
6 Correct 2 ms 860 KB Output is correct
7 Correct 2 ms 860 KB Output is correct
8 Correct 2 ms 860 KB Output is correct
9 Correct 2 ms 860 KB Output is correct
10 Correct 2 ms 860 KB Output is correct
11 Correct 2 ms 860 KB Output is correct
12 Incorrect 1 ms 348 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -