#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define It it=se.begin();it!=se.end();it++
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define unmap unordered_map
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define sh short int
#define mid (l+r)/2
#define S second
#define F first
#define sqr 708
using namespace std;
const ll inf = 1e9+1;
const ll mod = 1e9+7;
const int shift = 1e4;
const ld pai=acos(-1);
#include "train.h"
int n,m;
bool dp[5009];
bool done[50009];
vi A,R,v[5009];
bool dfs(int node,bool t){
t = max(t,(bool)R[node]);
if(done[node] == 1){
dp[node] = max(dp[node],t);
return dp[node];
}
done[node] = 1;
bool &ret = dp[node];
ret = 1-A[node];
for(auto u:v[node]){
if(A[node]){
ret = max(ret,dfs(u,t));
}
else{
ret = min(ret,dfs(u,t));
}
}
return ret;
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> vv) {
n = a.size(),m = u.size();
for(int i=0;i<n;i++){
A.pb(a[i]);
R.pb(r[i]);
}
for(int i=0;i<m;i++){
v[u[i]].pb(vv[i]);
}
vector<int> ret(n);
for(int i=0;i<n;i++){
ret[i] = dfs(i,0);
}
return ret;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
1228 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
1516 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
1224 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
1440 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
1228 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |