#include "Anthony.h"
#include <bits/stdc++.h>
typedef int ll;
using namespace std;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
namespace{}
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
if (a>2){
vector<int> edges[N];
FOR(i,0,M){
edges[U[i]].push_back(V[i]);
edges[V[i]].push_back(U[i]);
}
bool visited[N];
FOR(i,0,N) visited[i] = false;
vector<int> x(N);
FOR(i,0,N) x[i] = 0;
queue<vector<int>> q;
visited[0] = true;
q.push({0,0});
while (q.size()){
vector<int> node = q.front();
q.pop();
x[node[0]] = node[1];
for (auto&i : edges[node[0]]){
if (!visited[i]){
visited[i] = true;
q.push({i, node[1]+1});
}
}
}
vector<int> ans(M);
FOR(i,0,M){
ans[i] = (min(x[U[i]], x[V[i]])%3);
}
return ans;
}
vector<ll> pat = {1,0,1,1,0,0};
vector<vector<int>> edges[N];
FOR(i,0,M){
edges[U[i]].push_back({V[i],i});
edges[V[i]].push_back({U[i],i});
}
bool visited[N];
FOR(i,0,N) visited[i] = false;
vector<int> x(N);
vector<int> ans(M);
FOR(i,0,N) x[i] = 0;
queue<vector<int>> q;
visited[0] = true;
q.push({0,0});
while (q.size()){
vector<int> node = q.front();
q.pop();
for (auto&i : edges[node[0]]){
if (edges[node[0]].size() == 2){
if (!visited[i[0]]){
visited[i[0]] = true;
ans[i[1]] = pat[node[1]%6];
q.push({i[0], node[1]+1});
}
}else{
if (!visited[i[0]]){
visited[i[0]] = true;
ll cur = -1;
if (pat[(node[1]-1+6)%6]==0){
cur = 0;
}else{
cur = 5;
}
ans[i[1]] = pat[cur%6];
q.push({i[0], cur+1});
}
}
}
}
// for (auto&i : ans){
// cout << i << endl;
// }
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
typedef int ll;
using namespace std;
#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
namespace {
int A, B;
ll choice,moved,last;
bool up,init;
vector<ll> stuff;
set<vector<ll>> down;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
choice = 0;
moved = 0;
last = 0;
up = false;
init = false;
down = {
{1,0,1,1,0,0},
{0,1,1,0,0,1},
{1,1,0,0,1,0},
{1,0,0,1,0,1},
{0,0,1,0,1,1},
{0,1,0,1,1,0}
};
}
int Move(std::vector<int> y) {
if (A>2){
if (!y[0] && y[1] && y[2]){
return 1;
}
if (y[0] && !y[1] && y[2]){
return 2;
}
if (y[0] && y[1] && !y[2]){
return 0;
}
if (y[0] && !y[1] && !y[2]){
return 0;
}
if (!y[0] && y[1] && !y[2]){
return 1;
}
if (!y[0] && !y[1] && y[2]){
return 2;
}
}
//cout << y[0] << " " << y[1] << " " << up << endl;
if (!init){
init = true;
if (y[0]+y[1] == 2){
if (y[0]>0){
last = 0;stuff.push_back(0);
return 0;
} else{
last = 1;stuff.push_back(1);
return 1;
}
}else{
up = true;
if (y[0]==1){
last = 0;
return 0;
}else{
last = 1;
return 1;
}
}
}
if (!up){
if (stuff.size()==6){
if (down.count(stuff)){
up = true;
return -1;
}
else{
up = true;
}
}
else{
if (y[0]+y[1]==1){
if (y[0]){
last = 0;stuff.push_back(0);return 0;
}
else{
last = 1;stuff.push_back(1);return 1;
}
}
else{
up = true;
if (y[1-last]==1){
last = 1-last;
return last;
}else{
return -1;
}
}
}
}
if (up){
if (y[0]==1 && y[1]==0){
last = 0; return 0;
}
if (y[0]==0 && y[1]==1){
last = 1; return 1;
}
last = 1-last;
return last;
}
// if (!y[0] && y[1] && y[2]){
// return 1;
// }
// if (y[0] && !y[1] && y[2]){
// return 2;
// }
// if (y[0] && y[1] && !y[2]){
// return 0;
// }
// if (y[0] && !y[1] && !y[2]){
// return 0;
// }
// if (!y[0] && y[1] && !y[2]){
// return 1;
// }
// if (!y[0] && !y[1] && y[2]){
// return 2;
// }
}
Compilation message
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:18:7: error: 'a' was not declared in this scope
18 | if (a>2){
| ^
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:169:1: warning: control reaches end of non-void function [-Wreturn-type]
169 | }
| ^