#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]);
dp[node] == max(dp[node],t);
if(done[node] == 1){
return dp[node];
}
done[node] = 1;
bool 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++){
mem(dp,0);
mem(done,0);
ret[i] = dfs(i,0);
}
return ret;
}
Compilation message
train.cpp: In function 'bool dfs(int, bool)':
train.cpp:32:14: warning: value computed is not used [-Wunused-value]
32 | dp[node] == max(dp[node],t);
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
277 ms |
1100 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
460 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
230 ms |
1356 KB |
Output is correct |
2 |
Correct |
207 ms |
1340 KB |
Output is correct |
3 |
Correct |
209 ms |
1308 KB |
Output is correct |
4 |
Incorrect |
1278 ms |
1252 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
971 ms |
1104 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1282 ms |
1228 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
277 ms |
1100 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |