#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+100){
rep(i,0,N){
if(a[i] == 1){
for(auto next: edge[i]){
dp[i] |= dp[next];
}
}
else{
int val = 1;
for(auto next: edge[i]){
val &= dp[next];
}
dp[i] |= val;
}
}
}
rep(i,0,N) dp[i] = 1-dp[i];
REP(t,0,N+100){
rep(i,0,N){
if(a[i] == 0){
for(auto next: edge[i]){
dp[i] |= dp[next];
}
}
else{
int val = 1;
for(auto next: edge[i]){
val &= dp[next];
}
dp[i] |= val;
}
}
}
rep(i,0,N) dp[i] = 1-dp[i];
return dp;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
210 ms |
748 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 4th token, expected: '0', found: '1' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
298 ms |
1036 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
371 ms |
896 KB |
Output is correct |
2 |
Correct |
388 ms |
944 KB |
Output is correct |
3 |
Correct |
446 ms |
1040 KB |
Output is correct |
4 |
Correct |
471 ms |
1012 KB |
Output is correct |
5 |
Correct |
445 ms |
1008 KB |
Output is correct |
6 |
Correct |
423 ms |
1008 KB |
Output is correct |
7 |
Correct |
475 ms |
980 KB |
Output is correct |
8 |
Correct |
449 ms |
992 KB |
Output is correct |
9 |
Correct |
435 ms |
960 KB |
Output is correct |
10 |
Correct |
443 ms |
1032 KB |
Output is correct |
11 |
Correct |
477 ms |
980 KB |
Output is correct |
12 |
Correct |
450 ms |
1020 KB |
Output is correct |
13 |
Correct |
463 ms |
1100 KB |
Output is correct |
14 |
Correct |
412 ms |
852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
517 ms |
1028 KB |
Output is correct |
2 |
Correct |
549 ms |
1024 KB |
Output is correct |
3 |
Correct |
548 ms |
932 KB |
Output is correct |
4 |
Correct |
524 ms |
956 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
200 ms |
748 KB |
Output is correct |
7 |
Correct |
25 ms |
724 KB |
Output is correct |
8 |
Incorrect |
27 ms |
768 KB |
3rd lines differ - on the 5th token, expected: '0', found: '1' |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
210 ms |
748 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |