| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 427614 | amunduzbaev | 길고양이 (JOI20_stray) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Catherine.h"
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define sz(x) (int)x.size()
vector<int> path;
int a;
void Init(int a, int b) { ::a = a; }
namespace sol1{
vector<int> ppat = {0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0};
int ok = 0, last = -1;
vector<int> path;
int Move(vector<int> y){
if(ok){
assert(~last);
if(y[0] + y[1] + 1 > 2) return last ^= 1;
if(y[0] == 0) return last = 1;
if(y[1] == 0) return last = 0;
assert(0);
}
if(y[0] + y[1] + (last != -1) > 2){
if(last != -1) y[last]++;
ok = 1;
if(y[0] == 1){
if(last == 0) return -1;
return last = 0;
} if(y[1] == 1){
if(last == 1) return -1;
return last = 1;
}
}
if(y[0] + y[1] + (last != -1) == 1){
ok = 1;
if(y[0] == 1) return last = 0;
if(y[1] == 1) return last = 1;
return -1;
}
if(last == -1){
if(y[0] == 2) { path.pb(0), path.pb(0); return last = 0; }
else if(y[1] == 2) { path.pb(1), path.pb(1); return last = 1; }
else { path.pb(0), path.pb(1); return last = 1; }
}
else {
if(y[0] == 1) last = 0, path.pb(0);
if(y[1] == 1) last = 1, path.pb(1);
if(sz(path) == 5){ ok = 1;
for(int i=0;i+5<=sz(ppat);i++){
int l = i, r = i + 5 - 1, okk = 1;
for(int j=l;j<=r;j++) okk &= (ppat[j] == path[j-i]);
if(okk) return -1;
} if(y[0]) return last = 0;
else return last = 1;
} else return last;
}
}
}
namespace sol2{
int Move(vector<int> y){
return 0;
}
}
int Move(vector<int> y) {
if(a == 2) return sol1::Move(y);
else return sol2::Move(y);
}
