Submission #261117

#TimeUsernameProblemLanguageResultExecution timeMemory
261117sjimedStray Cat (JOI20_stray)C++14
0 / 100
51 ms16164 KiB
#include "Anthony.h" #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(0); #define fi first #define se second #define all(v) (v).begin(), (v).end() #define em emplace #define eb emplace_back #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INF = 1e18; const int inf = 1e9; static vector<pii> g[20010]; static vector<int> ret; static int tb[6] = {0, 1, 0, 0, 1, 1}; static void dfs(int x, int p, int k) { int t = 1 - tb[k]; if(x != 0 && g[x].size() == 2) t = (k + 1) % 6; for(auto i : g[x]) { if(i.fi == p) continue; ret[i.se] = tb[t]; dfs(i.fi, x, t); } } std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) { for(int i=0; i<M; i++) g[U[i]].eb(V[i], i), g[V[i]].eb(U[i], i); ret.resize(M, 0); dfs(0, 0, 0); /*for(auto i : ret) { cout << i; } cout << endl;*/ return ret; }
#include "Catherine.h" #include<bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(false); cin.tie(0); #define fi first #define se second #define all(v) (v).begin(), (v).end() #define em emplace #define eb emplace_back #define mp make_pair typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INF = 1e18; const int inf = 1e9; static int cnt, mask, prv = -1; static bool flag = false; static int a, b; void Init(int A, int B) { a = A; b = B; } int Move(std::vector<int> y) { cnt++; int d = y[0] + y[1]; if(prv != -1) d++; if(flag) { if(d >= 3) return 1 - prv; else return prv = y[1]; } if(d == 1) { flag = true; if(prv != -1) return -1; return prv = y[1]; } if(d >= 3 && y[1]) { flag = true; if(prv == 1) return -1; return prv = 1; } if(d >= 3 && y[0]) { flag = true; if(prv == 0) return -1; return prv = 0; } if(cnt == 1) { if(y[1]) prv = 1; else prv = 0; mask |= (y[1] - prv << 1); mask |= prv; return prv; } if(cnt <= 3) { mask <<= 1; mask |= y[1]; return prv = y[1]; } if(cnt == 4) { flag = true; mask <<= 1; mask |= y[1]; mask &= 31; if(mask==25 || mask == 18 || mask == 5 || mask == 11 || mask == 22 || mask == 12) return prv = y[1]; else return -1; } }

Compilation message (stderr)

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:60:19: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
     mask |= (y[1] - prv << 1);
Catherine.cpp:84:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...