# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
924407 | socpite | Stray Cat (JOI20_stray) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}