#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<10*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);
}
ndp[j] = min(ndp[j],3*n);
}
else{
ndp[j] = 1e9;
for(auto u:adj[j]){
ndp[j] = min(ndp[j],dp[u] + r[j]*n - 1);
}
ndp[j] = min(ndp[j],3*n);
}
}
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] >= n);
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1839 ms |
768 KB |
3rd lines differ - on the 296th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
428 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
420 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
0 ms |
340 KB |
Output is correct |
20 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2091 ms |
980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2073 ms |
852 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2098 ms |
980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1839 ms |
768 KB |
3rd lines differ - on the 296th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |