Submission #212383

#TimeUsernameProblemLanguageResultExecution timeMemory
212383dolphingarlicStray Cat (JOI20_stray)C++14
100 / 100
105 ms16740 KiB
#include "Anthony.h" #include <bits/stdc++.h> #define FOR(i,x,y) for(int i=x; i < y; i++) using namespace std;namespace{vector<int> X,p={0,1,0,0,1,1};vector<pair<int,int>> g[20000];void T(int n=0,int r=-1,int d=0){if(~r)X[r]=p[d];for(pair<int,int> i:g[n])if(i.second != r){if(g[n].size()== 2)T(i.first,i.second,(d+1)% 6);else T(i.first,i.second,1 ^ p[d]);}}int v[20000];void G(){queue<int> q;q.push(0);v[0]=1;while(q.size()){int c=q.front();q.pop();for(pair<int,int> i:g[c])if(!v[i.first]){X[i.second]=(v[c]-1)% 3;v[i.first]=v[c]+1;q.push(i.first); } else X[i.second]=(v[i.first]-1)% 3;}}}vector<int> Mark(int N,int M,int A,int B,vector<int> U,vector<int> V){FOR(i,0,M){g[U[i]].push_back({V[i],i});g[V[i]].push_back({U[i],i});}X.resize(M);if(B)T();else G();return X;}
#include "Catherine.h" #include <bits/stdc++.h> #define FOR(i,x,y) for(int i=x; i < y; i++) using namespace std;namespace {int A,B,l;bool o;vector<int> s;vector<vector<int>> O={{1,1,0,0,1},{1,0,0,1,0},{0,0,1,0,1},{0,1,0,1,1},{1,0,1,1,0},{0,1,1,0,0},};int T(vector<int> y){vector<int> Y=y;if(~l)Y[l]++;int deg=accumulate(Y.begin(),Y.end(),0);if(deg != 2)o=true;if(o){if(deg == 1){if(l == -1)FOR(i,0,A)if(y[i])return l=i;return -1;} else if(deg == 2){FOR(i,0,A)if(y[i])return l=i;} else {FOR(i,0,A)if(Y[i] == 1){if(!y[i])return -1;return l=i;}}} else {if(~l){FOR(i,0,A)if(y[i]){s.push_back(i);if(s.size()< 5)return l=i;else {o=true;for(vector<int> v : O)if(v == s)return l=i;return -1;}}} else {FOR(i,0,A)if(y[i]){s.push_back(i);y[i]--;FOR(j,0,A)if(y[j]){s.push_back(j);return l=j;}}}}}int G(vector<int> y){if(~l)y[l]++;FOR(i,0,3)if(y[i] && y[(i+1)% 3])return l=i;FOR(i,0,3)if(y[i])return l=i;}}void Init(int A,int B){::A=A;::B=B;o=false;l=-1;}int Move(vector<int> y){if(B)return T(y);return G(y);}

Compilation message (stderr)

Catherine.cpp: In function 'int {anonymous}::T(std::vector<int>)':
Catherine.cpp:4:692: warning: control reaches end of non-void function [-Wreturn-type]
 using namespace std;namespace {int A,B,l;bool o;vector<int> s;vector<vector<int>> O={{1,1,0,0,1},{1,0,0,1,0},{0,0,1,0,1},{0,1,0,1,1},{1,0,1,1,0},{0,1,1,0,0},};int T(vector<int> y){vector<int> Y=y;if(~l)Y[l]++;int deg=accumulate(Y.begin(),Y.end(),0);if(deg != 2)o=true;if(o){if(deg == 1){if(l == -1)FOR(i,0,A)if(y[i])return l=i;return -1;} else if(deg == 2){FOR(i,0,A)if(y[i])return l=i;} else {FOR(i,0,A)if(Y[i] == 1){if(!y[i])return -1;return l=i;}}} else {if(~l){FOR(i,0,A)if(y[i]){s.push_back(i);if(s.size()< 5)return l=i;else {o=true;for(vector<int> v : O)if(v == s)return l=i;return -1;}}} else {FOR(i,0,A)if(y[i]){s.push_back(i);y[i]--;FOR(j,0,A)if(y[j]){s.push_back(j);return l=j;}}}}}int G(vector<int> y){if(~l)y[l]++;FOR(i,0,3)if(y[i] && y[(i+1)% 3])return l=i;FOR(i,0,3)if(y[i])return l=i;}}void Init(int A,int B){::A=A;::B=B;o=false;l=-1;}int Move(vector<int> y){if(B)return T(y);return G(y);}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^
Catherine.cpp: In function 'int {anonymous}::G(std::vector<int>)':
Catherine.cpp:4:800: warning: control reaches end of non-void function [-Wreturn-type]
 using namespace std;namespace {int A,B,l;bool o;vector<int> s;vector<vector<int>> O={{1,1,0,0,1},{1,0,0,1,0},{0,0,1,0,1},{0,1,0,1,1},{1,0,1,1,0},{0,1,1,0,0},};int T(vector<int> y){vector<int> Y=y;if(~l)Y[l]++;int deg=accumulate(Y.begin(),Y.end(),0);if(deg != 2)o=true;if(o){if(deg == 1){if(l == -1)FOR(i,0,A)if(y[i])return l=i;return -1;} else if(deg == 2){FOR(i,0,A)if(y[i])return l=i;} else {FOR(i,0,A)if(Y[i] == 1){if(!y[i])return -1;return l=i;}}} else {if(~l){FOR(i,0,A)if(y[i]){s.push_back(i);if(s.size()< 5)return l=i;else {o=true;for(vector<int> v : O)if(v == s)return l=i;return -1;}}} else {FOR(i,0,A)if(y[i]){s.push_back(i);y[i]--;FOR(j,0,A)if(y[j]){s.push_back(j);return l=j;}}}}}int G(vector<int> y){if(~l)y[l]++;FOR(i,0,3)if(y[i] && y[(i+1)% 3])return l=i;FOR(i,0,3)if(y[i])return l=i;}}void Init(int A,int B){::A=A;::B=B;o=false;l=-1;}int Move(vector<int> y){if(B)return T(y);return G(y);}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...