#include <iostream>
#include <vector>
#include <queue>
#include <cassert>
using namespace std;
#define f first
#define s second
#define pb push_back
#define ar array
#define all(x) x.begin(), x.end()
#define siz(x) (int)x.size()
#define FOR(x, y, z) for(int x = (y); x < (z); x++)
#define ROF(x, z, y) for(int x = (y-1); x >= (z); x--)
#define F0R(x, z) FOR(x, 0, z)
#define R0F(x, z) ROF(x, 0, z)
#define trav(x, y) for(auto&x:y)
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<class T> inline bool ckmin(T&a, T b) {return b < a ? a = b, 1 : 0;}
template<class T> inline bool ckmax(T&a, T b) {return b > a ? a = b, 1 : 0;}
const char nl = '\n';
const int mxN = 20010;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
int n, m, a, b, d[mxN];
vi U, V, adj[mxN], res;
queue<int> q;
int amt[3] = {0, 1, 2};
vi Mark(int N, int M, int A, int B, vi Uu, vi Vv){
U = Uu; V = Vv; n = N; m = M; a = A; b = B;
if(a==2){
assert(false);
}
else{
res.resize(m);
F0R(i, m){
adj[U[i]].pb(V[i]);
adj[V[i]].pb(U[i]);
}
d[0] = 0;
q.push(0);
while(!q.empty()){
int u = q.front(); q.pop();
trav(v, adj[u]){
if(ckmin(d[v], d[u]+1)){
q.push(v);
}
}
}
F0R(i, n){
// we want to give them the value of the vertex with the higher value so that we know where to go
if(d[U[i]]<d[V[i]])
swap(U[i], V[i]);
if(d[U[i]]==d[V[i]]){
res[i] = amt[d[U[i]]%3];
}
else{
res[i] = amt[d[V[i]]%3];
// if we have distance 2 and 3
// we will at 3 see that we have 2
}
}
return res;
}
}
#ifdef ACMX
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
return 0;
}
#endif
#include <vector>
#include <iostream>
#include <queue>
#include <cassert>
using namespace std;
#define f first
#define s second
#define pb push_back
#define ar array
#define all(x) x.begin(), x.end()
#define siz(x) (int)x.size()
#define FOR(x, y, z) for(int x = (y); x < (z); x++)
#define ROF(x, z, y) for(int x = (y-1); x >= (z); x--)
#define F0R(x, z) FOR(x, 0, z)
#define R0F(x, z) ROF(x, 0, z)
#define trav(x, y) for(auto&x:y)
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<class T> inline bool ckmin(T&a, T b) {return b < a ? a = b, 1 : 0;}
template<class T> inline bool ckmax(T&a, T b) {return b > a ? a = b, 1 : 0;}
const char nl = '\n';
const int mxN = 2e5 + 10;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
int a, b;
void Init(int A, int B){
a = A, b = B;
assert(b==0&&a>=3);
}
int Move(vi y){
if(y[0] == 0 && y[1] == 0 && y[2] == 0){
assert(false);
}
else if(y[0] == 0 && y[1] == 0){
return 2;
}
else if(y[1] == 0 && y[2] == 0){
return 0;
}
else if(y[2] == 0 && y[0] == 0){
return 1;
}
else if(y[0] == 0){
return 2;
}
else if(y[1] == 0){
return 0;
}
else if(y[2] == 0){
return 1;
}
else{
assert(false);
}
}
#ifdef ACMX
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
return 0;
}
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
26812 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
26812 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
54 ms |
22140 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
54 ms |
22140 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
1408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
9 ms |
2432 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
2408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |