#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll INF = 1000000000000000000LL;
ll n, m, q, k, x, y, a, c;
vector<ll> G[5000];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
n = a.size();
m = u.size();
queue<ll> q;
vector<ll> cnt(n);
vector<int> vis(n);
for (int i = 0; i < m; i++) {
cnt[u[i]]++;
G[v[i]].push_back(u[i]);
}
for (int i = 0; i < n; i++) {
if (r[i]) {
q.push(i);
}
}
while (!q.empty()) {
ll x = q.front();
q.pop();
if (vis[x]) {
continue;
}
vis[x] = 1;
for (auto i : G[x]) {
if (a[i] && !vis[i]) {
q.push(i);
}
if (!a[i]) {
cnt[i]--;
if (cnt[i] == 0 && !vis[i]) {
q.push(i);
}
}
}
}
return vis;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
832 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 |
352 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 |
1556 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 |
1384 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 |
Correct |
6 ms |
1380 KB |
Output is correct |
2 |
Correct |
5 ms |
1452 KB |
Output is correct |
3 |
Correct |
5 ms |
1384 KB |
Output is correct |
4 |
Correct |
5 ms |
1432 KB |
Output is correct |
5 |
Correct |
1 ms |
612 KB |
Output is correct |
6 |
Incorrect |
4 ms |
872 KB |
3rd lines differ - on the 3730th token, expected: '0', found: '1' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
832 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |