Submission #204834

#TimeUsernameProblemLanguageResultExecution timeMemory
204834MvCCop and Robber (BOI14_coprobber)C++11
16 / 100
207 ms262148 KiB
#pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include "coprobber.h" #include <bits/stdc++.h> #define rc(x) return cout<<x<<endl,0 #define pb push_back #define mkp make_pair #define in insert #define er erase #define fd find #define fr first #define sc second typedef long long ll; typedef long double ld; const ll INF=0x3f3f3f3f3f3f3f3f; const ll llinf=(1LL<<62); const int inf=(1<<30); const int nmax=5e2+50; const int mod=1e9+7; using namespace std; int n,tt,tin[nmax],tout[nmax],x,y; vector<int>a[nmax]; void dfs(int x,int p) { tin[x]=++tt; for(int i=0;i<(int)a[x].size();i++) { int y=a[x][i]; if(y==p)continue; dfs(y,x); } tout[x]=++tt; } bool ok(int x,int y) { return tin[x]<=tin[y] && tout[x]>=tout[y]; } int start(int N,bool A[500][500]) { n=N; for(int i=0;i<n;i++)for(int j=0;j<n;j++)if(A[i][j])a[i].pb(j); dfs(0,0); x=0; return 0; } int nextMove(int y) { for(int i=0;i<(int)a[x].size();i++) { if(ok(a[x][i],y) && ok(x,a[x][i])) { x=a[x][i]; break; } } return x; } /*int main() { //freopen("sol.in","r",stdin); //freopen("sol.out","w",stdout); //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0); return 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...