# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1180189 | PlayVoltz | 길고양이 (JOI20_stray) | C++20 | 0 ms | 0 KiB |
#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
vector<int> Mark(int n, int m, int A, int B, vector<int> u, vector<int> v){
vector<vector<int> > graph(n);
vector<int> res(m, -1), a, vect(n, -1);
for (int i=0; i<m; ++i){
graph[u[i]].pb(i);
graph[v[i]].pb(i);
}
if (A>2)a={0, 1, 2};
else a={0, 1, 0, 0, 1, 1};
queue<int> q;
vect[0]=0;
q.push(0);
while (q.size()){
int node=q.front();
q.pop();
for (auto id:graph[node]){
int num=u[id]^v[id]^node;
if (res[id]==-1)res[id]=a[vect[node]];
if (vect[num]==-1){
if (graph[num].size()>2&&A==2)vect[num]=!a[vect[node]];
else vect[num]=(vect[node]+1)%a.size();
q.push(num);
}
}
}
return res;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
namespace{
int A, B, pans;
bool lost;
string s, a="010011010011";
}
void Init(int a, int b){
A=a, B=b;
pans=-1;
lost=1;
s="";
}
int Move(vector<int> vect){
if (A>2){
if (!vect[0])return (vect[1]?1:2);
if (!vect[1])return (vect[2]?2:0);
return (vect[0]?0:1);
}
if (vect[0]+vect[1]>2){
lost=0;
if (pans==-1)return pans=(vect[1]==1);
if (!vect[pans])return -1;
return pans=!pans;
}
else if (vect[0]+vect[1]==1){
lost=0;
if (pans==-1)return pans=vect[1];
return -1;
}
else if (!lost)return pans=vect[1];
else{
for (int i=0; i<vect[0].size(); ++i)s.pb('0');
for (int i=0; i<vect[1].size(); ++i)s.pb('1');
if (s.size()==5){
lost=0;
for (int i=0; i<6; ++i)if (s==a.substr(i, 5))return -1;
}
if (vect[0]&&vect[1])return pans=1;
return pans=!!vect[1];
}
}