#include "train.h"
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
typedef long long ll;
const ll inf=1e9;
vector<vector<int> > e;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n=a.size(),m=u.size();
vector<int> ans(n);
e.resize(n);
for(int i=0;i<m;i++){
e[u[i]].push_back(v[i]);
}
vector<vector<int> > ab(n,vector<int>(n));
for(int i=0;i<n;i++){
queue<int> q;
q.push(i);
while(q.size()){
auto h=q.front();
q.pop();
for(auto y:e[h]){
if(!ab[i][y]){
ab[i][y]=1;
q.push(y);
}
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(ab[i][j] && ab[j][j] && r[j]==1){
ans[i]=1;
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
284 ms |
98812 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 |
Incorrect |
1 ms |
212 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
373 ms |
99108 KB |
Output is correct |
2 |
Correct |
401 ms |
99100 KB |
Output is correct |
3 |
Correct |
395 ms |
99092 KB |
Output is correct |
4 |
Correct |
964 ms |
99088 KB |
Output is correct |
5 |
Correct |
725 ms |
99296 KB |
Output is correct |
6 |
Correct |
596 ms |
99292 KB |
Output is correct |
7 |
Correct |
581 ms |
99280 KB |
Output is correct |
8 |
Correct |
414 ms |
99280 KB |
Output is correct |
9 |
Correct |
380 ms |
99244 KB |
Output is correct |
10 |
Correct |
468 ms |
99252 KB |
Output is correct |
11 |
Correct |
422 ms |
99224 KB |
Output is correct |
12 |
Correct |
101 ms |
99124 KB |
Output is correct |
13 |
Correct |
1000 ms |
99296 KB |
Output is correct |
14 |
Correct |
945 ms |
99292 KB |
Output is correct |
15 |
Correct |
938 ms |
99300 KB |
Output is correct |
16 |
Correct |
967 ms |
99288 KB |
Output is correct |
17 |
Correct |
936 ms |
99288 KB |
Output is correct |
18 |
Correct |
459 ms |
98988 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
781 ms |
98960 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
951 ms |
99084 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
284 ms |
98812 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |