Submission #556299

#TimeUsernameProblemLanguageResultExecution timeMemory
556299new_accCop and Robber (BOI14_coprobber)C++14
0 / 100
42 ms2996 KiB
#include "coprobber.h" #include<bits/stdc++.h> #define fi first #define se second #define pitem item* using namespace std; typedef long long ll; typedef unsigned long long ull; typedef vector<int> vi; typedef vector<ll> vl; const int N=500; const int SS=1<<19; const int INFi=2e9; const ll INFl=1e13; const ll mod2=998244353; const ll mod=1e9+7; const ll mod3=1000696969; const ll p=70032301; const ull p2=913; const int L=20; struct st{ int a,b,c; }; bool dp[N][N][2]; int nxt[N][N],il[N],last; vi graf[N]; int start(int n, bool t[N][N]){ for(int i=0;i<n;i++){ for(int j=0;j<n;j++) if(t[i][j]) graf[i].push_back(j); } deque<st>deq; for(int i=1;i<=n;i++) deq.push_back({i,i,0}),deq.push_back({i,i,1}); while(deq.size()){ st v=deq.front(); deq.pop_front(); dp[v.a][v.b][v.c]=1; if(v.c){ for(auto u:graf[v.b]){ il[u]++; if(il[u]==graf[u].size()) deq.push_back({u,v.a,0}); } }else{ for(auto u:graf[v.b]) if(!dp[u][v.a][1]) deq.push_back({u,v.a,1}),nxt[u][v.a]=v.b; if(!dp[v.b][v.a][1]) deq.push_back({v.b,v.a,1}),nxt[v.b][v.a]=v.b; } } for(int i=0;i<n;i++){ bool ok=1; for(int k=0;k<n;k++) ok&=dp[i][k][1]; if(ok){ last=i; return i; } } return -1; } int nextMove(int R){ return nxt[last][R]; }

Compilation message (stderr)

coprobber.cpp: In function 'int start(int, bool (*)[500])':
coprobber.cpp:42:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |                 if(il[u]==graf[u].size()) deq.push_back({u,v.a,0});
      |                    ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...