#include "train.h"
#include <bits/stdc++.h>
#define N 5005
using namespace std;
int dp[N];
int 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] = -1e9;
for(auto u:adj[j]){
ndp[j] = max(ndp[j],dp[u] + r[j]*n - 1);
}
}
else{
ndp[j] = 1e9;
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
567 ms |
768 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 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 |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Incorrect |
1 ms |
340 KB |
3rd lines differ - on the 5th token, expected: '0', found: '1' |
11 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
939 ms |
1064 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1028 ms |
976 KB |
Output is correct |
2 |
Correct |
1140 ms |
980 KB |
Output is correct |
3 |
Correct |
1216 ms |
1044 KB |
Output is correct |
4 |
Incorrect |
1221 ms |
1028 KB |
3rd lines differ - on the 40th token, expected: '0', found: '1' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1275 ms |
1044 KB |
Output is correct |
2 |
Correct |
1262 ms |
1048 KB |
Output is correct |
3 |
Correct |
1360 ms |
1040 KB |
Output is correct |
4 |
Correct |
1189 ms |
980 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
6 |
Correct |
546 ms |
780 KB |
Output is correct |
7 |
Correct |
61 ms |
852 KB |
Output is correct |
8 |
Correct |
73 ms |
852 KB |
Output is correct |
9 |
Correct |
73 ms |
884 KB |
Output is correct |
10 |
Correct |
4 ms |
468 KB |
Output is correct |
11 |
Correct |
101 ms |
724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
567 ms |
768 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |