# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
235259 | Goolakh | Cop and Robber (BOI14_coprobber) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/// Be Kind :)
#include <bits/stdc++.h>
#include "coprobber.h"
using namespace std;
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
//#pragma GCC optimize("Os")
/* Bitch, where you when I was walkin'?
Now I run the game, got the whole world talkin' */
/* You never likes us anyway, fuck your friendship, I meant it */
/* The Chanel or Balenciaga, Louis and Vuitton
She know I got Fendi, Prada when I hit Milan */
/* Niggas been counting me out
I'm counting my bullets, I'm loading my clips
I'm writing down names, I'm making a list */
/* I ran away, I don't think I'm coming back home */
#define F first
#define S second
#define pb push_back
#define SZ(x) (ll)(x.size())
#define all(x) x.begin(),x.end()
typedef int ll;
typedef pair<ll,ll> pll;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll maxn=5e2+10, maxm=51, lg=23, mod=1e9+7, inf=1e18;
ll n,cur;
bool g[maxn][maxn],win[maxn][maxn];
ll cnt[maxn][maxn],nxt[maxn][maxn];
ll tg[maxn];
ll start(ll N,bool A[MAX_N][MAX_N]){
n=N;
for(int i=0;i<n;i++){
tg[i]=0;
for(int j=0;j<n;j++){
g[i][j]=G[i][j];
tg[i]+=g[i][j];
cnt[i][j]=0;
}
}
deque<pair<ll,pll>> q;
for(int i=0;i<n;i++){
q.pb({0,{i,i}});
q.pb({1,{i,i}});
win[i][i]=1;
}
while(!q.empty()){
auto v=q.front(); q.pop_front();
if(v.F==1){
for(int i=0;i<n;i++)if(g[i][v.S.F] || i==v.S.F)if(!win[i][v.S.S]){
win[i][v.S.S]=1;
nxt[i][v.S.S]=v.S.F;
q.pb({0,{i,v.S.S}});
}
}
if(v.F==0){
for(int i=0;i<n;i++)if(g[i][v.S.S]){
cnt[v.S.F][i]++;
if(cnt[v.S.F][i]==tg[i]) q.pb({1,{v.S.F,i}});
}
}
}
}
ll next_move(ll r){
return cur=nxt[cur][r];
}
/*
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
return 0;
}
*/