#include "train.h"
#include <bits/stdc++.h>
#define N 5005
using namespace std;
long long dp[N];
long long ndp[N];
vector<int> adj[N];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n = a.size();
int m = u.size();
for(int i = 0;i<m;i++){
adj[u[i]].push_back(v[i]);
}
for(int i=0;i<4*n;i++){
for(int j = 0;j<n;j++){
if(a[j]){
ndp[j] = -1e18;
for(auto u:adj[j]){
ndp[j] = max(ndp[j],dp[u] + r[j]*n - 1);
}
}
else{
ndp[j] = 1e18;
for(auto u:adj[j]){
ndp[j] = min(ndp[j],dp[u] + r[j]*n - 1);
}
}
}
for(int j = 0;j<n;j++){
dp[j] = ndp[j];
}
}
vector<int> res(n);
for(int i = 0; i < n; i++){
res[i] = (dp[i] > 0);
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
630 ms |
812 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 |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Incorrect |
0 ms |
340 KB |
3rd lines differ - on the 9th token, expected: '0', found: '1' |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
859 ms |
1108 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 |
971 ms |
960 KB |
Output is correct |
2 |
Correct |
1096 ms |
1020 KB |
Output is correct |
3 |
Correct |
1218 ms |
1088 KB |
Output is correct |
4 |
Incorrect |
1376 ms |
1280 KB |
3rd lines differ - on the 40th token, expected: '0', found: '1' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1203 ms |
1092 KB |
Output is correct |
2 |
Correct |
1261 ms |
1084 KB |
Output is correct |
3 |
Correct |
1303 ms |
1080 KB |
Output is correct |
4 |
Correct |
1152 ms |
1100 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
582 ms |
812 KB |
Output is correct |
7 |
Correct |
52 ms |
852 KB |
Output is correct |
8 |
Correct |
71 ms |
852 KB |
Output is correct |
9 |
Correct |
58 ms |
884 KB |
Output is correct |
10 |
Correct |
4 ms |
564 KB |
Output is correct |
11 |
Correct |
89 ms |
808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
630 ms |
812 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |