# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
246343 | kostia244 | Stray Cat (JOI20_stray) | C++17 | 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>
#define pb push_back
using namespace std;
namespace kate {
int A, B, gg = 0, lst = -2;
string cur, god = "110100110100";
int decide(vector<int> c) {
if(c[0] + c[1] == 0) {
gg = 1;
return -1;
}
if(lst == -2 && c[0]+c[1] == 1) {
gg = 1;
return lst = c[1];
}
if(c[0] + c[1] + (lst != -2) > 2) {
gg = 1;
if(c[0] == 0) return -1;
if(c[1] == 0) return -1;
if(c[0] == 1) return lst = 0;
if(c[1] == 1) return lst = 1;
exit(-1);
}
if(c[0] + c[1] == 2) {
if(c[0]) {
cur.pb('0'+c[1]);
cur.pb('0');
return lst = 0;
}
cur += "11";
return lst = 1;
}
if(gg) return lst = c[1];
cur.pb('0'+c[1]);
if(cur.size() == 5) {
gg = 1;
//cout << " " << gg << "Yay\n";
if(god.find(cur) != string::npos) return -1;
}
return lst = c[1];
}
} // namespace
void Init(int A, int B) {
kate::A = A;
kate::B = B;
}
int Move(std::vector<int> y) {
//cout << y[0] << " " << y[1] << " go ";
int t = kate::decide(y);
//cout <<kate::cur << " " << t << endl;
return t;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
namespace kate {
int A, B, gg = 0, lst = -2;
string cur, god = "110100110100";
int decide(vector<int> c) {
if(c[0] + c[1] == 0) {
gg = 1;
return -1;
}
if(lst == -2 && c[0]+c[1] == 1) {
gg = 1;
return lst = c[1];
}
if(c[0] + c[1] + (lst != -2) > 2) {
gg = 1;
if(c[0] == 0) return -1;
if(c[1] == 0) return -1;
if(c[0] == 1) return lst = 0;
if(c[1] == 1) return lst = 1;
exit(-1);
}
if(c[0] + c[1] == 2) {
if(c[0]) {
cur.pb('0'+c[1]);
cur.pb('0');
return lst = 0;
}
cur += "11";
return lst = 1;
}
if(gg) return lst = c[1];
cur.pb('0'+c[1]);
if(cur.size() == 5) {
gg = 1;
//cout << " " << gg << "Yay\n";
if(god.find(cur) != string::npos) return -1;
}
return lst = c[1];
}
} // namespace
void Init(int A, int B) {
kate::A = A;
kate::B = B;
}
int Move(std::vector<int> y) {
//cout << y[0] << " " << y[1] << " go ";
int t = kate::decide(y);
//cout <<kate::cur << " " << t << endl;
return t;
}