Submission #771177

#TimeUsernameProblemLanguageResultExecution timeMemory
771177gagik_2007Monster Game (JOI21_monster)C++17
10 / 100
162 ms208 KiB
#include "monster.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; ll ttt; const ll INF=1e18; const ll MOD=1e9+7; const ll N=3e5+7; ll n,m,k; vector<int> Solve(int NN) { vector<int> a(NN); n=NN; if(n<=200){ int oo=-1,ot=-1,to=-1,tt=-1; vector<int>cnt(n, 0); for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ bool res=Query(i,j); if(res){ cnt[i]++; } else { cnt[j]++; } } if(cnt[i]==1){ if(oo==-1)oo=i; else ot=i; } else if(cnt[i]==n-2){ if(to==-1)to=i; else tt=i; } else{ a[i]=cnt[i]; } } // cout<<oo<<" "<<ot<<" "<<to<<" "<<tt<<endl; if(Query(oo,ot)){ a[oo]=0,a[ot]=1; } else{ a[oo]=1,a[ot]=0; } if(Query(to,tt)){ a[to]=n-2,a[tt]=n-1; } else{ a[to]=n-1,a[tt]=n-2; } } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...