# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445213 | flappybird | 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;
typedef int ll;
namespace {
int A, B;
int variable_example = 0;
ll pv;
ll str;
ll last;
string up[6], down[6];
bool chk(string s) {
for (ll i = 0; i < 6; i++) {
if (s == up[i]) return true;
}
return false;
}
string s;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
pv = -1;
str = 0;
last = 0;
up[0] = "00101";
up[1] = "01011";
up[2] = "10110";
up[3] = "01100";
up[4] = "11001";
up[5] = "10010";
}
int Move(std::vector<int> y) {
if (pv != -1) {
if ((y[0] + y[1] + 1) != 2) {
str = 0;
s.clear();
last = 1;
y[pv]++;
if (y[0] == 1) {
if (pv == 0) return -1;
else return pv = 0;
}
else {
if (pv == 1) return -1;
else return pv = 1;
}
}
else {
if (!last) {
str++;
ll nxt;
if (y[0]) nxt = 0;
else nxt = 1;
s.push_back(nxt + 48);
if (str == 5) {
if (chk(s)) {
last = 1;
str = 0;
s.clear();
return pv = nxt;
}
else {
last = 1;
str = 0;
s.clear();
return -1;
}
}
else {
return pv = nxt;
}
}
else {
if (y[0]) return pv = 0;
else return pv = 1;
}
}
}
else {
if ((y[0] + y[1]) != 2) {
last = 1;
if (y[0] == 1) return pv = 0;
else return pv = 1;
}
else {
if (y[0] == 2) {
s.push_back('0');
s.push_back('0');
str += 2;
return pv = 0;
}
else if (y[1] == 2) {
s.push_back('1');
s.push_back('1');
str += 2;
return pv = 1;
}
else {
s.push_back('0');
s.push_back('1');
str += 2;
return pv = 1;
}
}
}
}