//#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int A, B;
int sure = 0;
vector<int> sofar;
int prv = -2;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
//printf("new move\n");
//printf("wasted %d so far, sure ? %d\n",(int)sofar.size(),sure);
//for (int j = 0; j < A; ++j) printf("%d %d\n",j,y[j]);
if (A >= 3){
if (prv == -2){
if (y[0] == 0) return prv = y[1]?1:2;
else if (y[1] == 0) return prv = y[2]?2:0;
else if (y[2] == 0) return prv = y[0]?0:1;
}
else{
return prv = (prv+2)%3;
}
}
else{
if (!sure){
int total = y[0]+y[1];
if (total > 1){
if (sofar.empty()){
int choose;
if (y[0] + y[1] == 2) choose = y[0]?0:1;
else{
sure = true;
assert(y[0]==1||y[1]==1);
choose = y[0]==1?0:1;
}
sofar.push_back(choose);
return choose;
}
else{
sure = true;
if (y[0]==0||y[1]==0){
return -1;
}
else{
return y[0]==1?0:1;
}
}
}
else if (total == 0){
sure = true;
return -1;
}
else{
int cur = y[0] == 1?0:1;
if ((int)sofar.size() == 0){
sure = true;
return cur;
}
if ((int)sofar.size() == 3){
sure = true;
int CUR = 4*sofar[0] + 2*sofar[1] + sofar[2];
int need;
if (CUR == 0 || CUR == 2 || CUR == 5 || CUR == 3) need = 1;
else need = 0;
//printf("so far visited %d %d %d -> %d\n",sofar[0],sofar[1],sofar[2],need);
if (cur == need){
return -1;
}
else return cur;
}
else{
sofar.push_back(cur);
return cur;
}
}
}
else{
return y[0]==1?0:1;
}
}
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int A, B;
int sure = 0;
vector<int> sofar;
int prv = -2;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(std::vector<int> y) {
//printf("new move\n");
//printf("wasted %d so far, sure ? %d\n",(int)sofar.size(),sure);
//for (int j = 0; j < A; ++j) printf("%d %d\n",j,y[j]);
if (A >= 3){
if (prv == -2){
if (y[0] == 0) return prv = y[1]?1:2;
else if (y[1] == 0) return prv = y[2]?2:0;
else if (y[2] == 0) return prv = y[0]?0:1;
}
else{
return prv = (prv+2)%3;
}
}
else{
if (!sure){
int total = y[0]+y[1];
if (sofar.empty()){
if (total == 1){
sure = true;
return y[0]==1?0:1;
}
}
if (total > 1){
if (sofar.empty()){
int choose;
if (y[0] + y[1] == 2) choose = y[0]?0:1;
else{
sure = true;
assert(y[0]==1||y[1]==1);
choose = y[0]==1?0:1;
}
sofar.push_back(choose);
return choose;
}
else{
sure = true;
if (y[0]==0||y[1]==0){
return -1;
}
else{
return y[0]==1?0:1;
}
}
}
else if (total == 0){
sure = true;
return -1;
}
else{
int cur = y[0] == 1?0:1;
if ((int)sofar.size() == 3){
sure = true;
int CUR = 4*sofar[0] + 2*sofar[1] + sofar[2];
int need;
if (CUR == 0 || CUR == 2 || CUR == 5 || CUR == 3) need = 1;
else need = 0;
//printf("so far visited %d %d %d -> %d\n",sofar[0],sofar[1],sofar[2],need);
if (cur == need){
return -1;
}
else return cur;
}
else{
sofar.push_back(cur);
return cur;
}
}
}
else{
return y[0]==1?0:1;
}
}
}
Compilation message
Anthony.cpp: In function 'int Move(std::vector<int>)':
Anthony.cpp:89:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/tmp/ccaVqGcr.o: In function `main':
grader_anthony.cpp:(.text.startup+0x175): 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
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:91:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^