#include "train.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
ll n = a.size();
ll m = u.size();
std::vector<int> res(a.size());
for(int i = 0; i < (int)res.size(); i++)
res[i] = i % 2;
vector<vector<ll>> con(n),rcon(n);
for(ll i = 0;i<m;i++){
con[u[i]].push_back(v[i]);
rcon[v[i]].push_back(u[i]);
}
vector<ll> ans(n,0);
vector<ll> st;
for(ll i = 0;i<n;i++) if(r[i]) st.push_back(i);
while(st.size()){
ll i = st.back();st.pop_back();
if (ans[i]) continue;
ans[i] = 1;
for(ll j : rcon[i]) st.push_back(j);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1116 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 |
0 ms |
348 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 |
4 ms |
1628 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 |
4 ms |
1748 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 |
5 ms |
1628 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 |
3 ms |
1116 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |