#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
//1001
namespace {
int A, B;
int variable_example = 0;
int start = 1;
int on_line = 0;
int prv = 0;
int ptr = 0;
set<array<int, 5>> check = {
{1, 0, 1, 0, 0},
{0, 1, 0, 0, 1},
{1, 0, 0, 1, 1},
{0, 0, 1, 1, 0},
{0, 1, 1, 0, 1},
{1, 1, 0, 1, 0}
};
array<int, 5> crr;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
// MAX: <; MIN: >
int Move(std::vector<int> y) {
if(A == 2){
if(start){
start = 0;
if(y[0] + y[1] != 2){
if(min(y[0], y[1]) == 0)prv = y[0] < y[1];
else prv = y[0] > y[1];
return prv;
}
else {
on_line = 1;
prv = y[0] < y[1];
// cout << prv << endl;
y[prv]--;
crr[ptr++] = y[0] < y[1];
crr[ptr++] = prv;
return prv;
}
}
else{
if(!on_line){
if(min(y[0], y[1]) == 0)prv = y[0] < y[1];
else prv^=1;
return prv;
}
else {
if(y[0] + y[1] != 1){
on_line = 0;
ptr = 0;
if(min(y[0], y[1]) == 0)return -1;
else {
prv^=1;
return prv;
}
}
else{
prv = y[0] < y[1];
crr[ptr++] = prv;
if(ptr == 5){
on_line = 0;
if(check.find(crr) == check.end())return prv;
else {
prv = crr[3];
return -1;
}
}
else return prv;
}
}
}
}
return 0;
}
Compilation message
Anthony.cpp:9:8: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
9 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccqtbbKQ.o: in function `main':
grader_anthony.cpp:(.text.startup+0x191): undefined reference to `Mark(int, int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status
/usr/bin/ld: /tmp/cciGVq1B.o: in function `main':
grader_catherine.cpp:(.text.startup+0x41c): undefined reference to `Init(int, int)'
/usr/bin/ld: grader_catherine.cpp:(.text.startup+0xcfa): undefined reference to `Move(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status