#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define For(i, l, r) for (auto i = (l); i < (r); i++)
#define ForE(i, l, r) for (auto i = (l); i <= (r); i++)
#define FordE(i, l, r) for (auto i = (l); i >= (r); i--)
#define bend(a) (a).begin(), (a).end()
#define isz(a) ((int)(a).size())
struct edge_t{
int from, to;
};
const int N = 5e3 + 5, M = 2e4 + 5;
int n, m;
int a[N]; // true = A, false = B
bool b[N]; // is charging station
edge_t edge[N];
vector <int> adj[N], radj[N];
namespace subtask1{
bool check(){
For(i, 0, m){
if (not (edge[i].from == edge[i].to or edge[i].from + 1 == edge[i].to)){
return false;
}
}
return true;
}
vector <int> solve(){
vector <bool> has_self_loop(n, false);
For(i, 0, m){
if (edge[i].from == edge[i].to){
has_self_loop[edge[i].from] = true;
}
}
vector <int> ans(n);
ans[n - 1] = b[n - 1];
FordE(u, n - 2, 0){
if (a[u] and b[u] and has_self_loop[u]){
ans[u] = 1;
}
else if (not a[u] and not b[u] and has_self_loop[u]){
ans[u] = 0;
}
else{
ans[u] = ans[u + 1];
}
}
return ans;
}
}
vector <int> who_wins(vector <int> _a, vector <int> _r, vector <int> _u, vector <int> _v){
n = isz(_a); m = isz(_u);
For(u, 0, n){
a[u] = _a[u];
b[u] = _r[u];
}
For(i, 0, m){
int u = _u[i], v = _v[i];
edge[i] = edge_t{u, v};
adj[u].emplace_back(i);
radj[v].emplace_back(i);
}
if (subtask1::check()){
return subtask1::solve();
}
return vector <int>(n);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1108 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 |
544 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1492 KB |
Output is correct |
2 |
Correct |
7 ms |
1492 KB |
Output is correct |
3 |
Correct |
5 ms |
1452 KB |
Output is correct |
4 |
Incorrect |
5 ms |
1456 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
1324 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1364 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1108 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |