Submission #262518

#TimeUsernameProblemLanguageResultExecution timeMemory
262518arnold518Stray Cat (JOI20_stray)C++14
20 / 100
69 ms17020 KiB
#include "Anthony.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; static const int MAXN = 2e4; static int N, M, A, B, D[MAXN+10]; static pii E[MAXN+10]; static vector<pii> adj[MAXN+10]; static vector<int> ret; vector<int> Mark(int _N, int _M, int _A, int _B, vector<int> _U, vector<int> _V) { N=_N; M=_M; A=_A; B=_B; for(int i=1; i<=M; i++) { int u=_U[i-1]+1, v=_V[i-1]+1; adj[u].push_back({v, i}); adj[v].push_back({u, i}); E[i]={u, v}; } ret.resize(M); queue<int> Q; memset(D, -1, sizeof(D)); Q.push(1); D[1]=0; while(!Q.empty()) { int now=Q.front(); Q.pop(); for(auto nxt : adj[now]) { if(D[nxt.first]!=-1) continue; Q.push(nxt.first); D[nxt.first]=D[now]+1; } } if(B==0) { for(int i=1; i<=M; i++) ret[i-1]=min(D[E[i].first], D[E[i].second])%3; return ret; } for(int i=1; i<=M; i++) ret[i-1]=min(D[E[i].first], D[E[i].second])%2; return ret; }
#include "Catherine.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; static const int MAXN = 2e4; static int A, B; static vector<int> V; static int cnt, bef; void Init(int _A, int _B) { A=_A; B=_B; cnt=0; bef=-1; srand(time(NULL)); } int Move(vector<int> _V) { V=_V; cnt++; if(B==0) { if(V[0]==0 && V[1]==0) return 2; if(V[0]==0 && V[2]==0) return 1; if(V[2]==0 && V[1]==0) return 0; if(V[0]==0) return 1; if(V[1]==0) return 2; if(V[2]==0) return 0; } if(cnt==1) { if(V[0]==1 && V[1]!=1) return bef=0; if(V[1]==1 && V[0]!=1) return bef=1; if(V[0]==1 && V[1]==1) return bef=rand()%2; } else { if(V[0]==0 && V[1]==0) return -1; bef=!bef; return bef; } }

Compilation message (stderr)

Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:50:1: warning: control reaches end of non-void function [-Wreturn-type]
   50 | }
      | ^
#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...