#include "train.h"
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::vector;
using ll = int;
using vi = vector<ll>;
using vii = vector<vi>;
using std::string;
using pii = std::pair<ll,ll>;
#define rep(i,j,k) for(ll i=ll(j); i<ll(k); i++)
#define REP(i,j,k) for(ll i=ll(j); i<=ll(k); i++)
#define per(i,j,k) for(ll i=ll(j); i>=ll(k); i--)
#define ln "\n"
#define all(a) a.begin(), a.end()
#define mp std::make_pair
#define pb emplace_back
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
ll N = a.size();
vii edge(N);
rep(i,0,u.size()) edge[u[i]].pb(v[i]);
vi dp = r;
REP(t,0,N+10){
rep(i,0,N){
if(a[i] == 1){
int val = 0;
for(auto next: edge[i]){
val |= dp[next];
}
dp[i] |= val;
}
else{
int val = 1;
for(auto next: edge[i]){
val &= dp[next];
}
dp[i] &= val;
}
}
}
vi dp2 = dp;
rep(i,0,N) dp2[i] = 1-dp2[i];
REP(t,0,N+10){
rep(i,0,N){
if(a[i] == 0){
int val = 0;
for(auto next: edge[i]){
val |= dp2[next];
}
dp2[i] |= val;
}
else{
int val = 1;
for(auto next: edge[i]){
val &= dp2[next];
}
dp2[i] &= val;
}
}
}
rep(i,0,N) dp2[i] = 1-dp2[i];
return dp2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
238 ms |
768 KB |
3rd lines differ - on the 3rd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
307 ms |
1040 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
479 ms |
896 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
673 ms |
1044 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
238 ms |
768 KB |
3rd lines differ - on the 3rd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |