제출 #91487

#제출 시각아이디문제언어결과실행 시간메모리
91487faustaadpUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
4 ms640 KiB
#include "messy.h" #include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ll i,j,N,a[1010]; string s; void buat(ll aa,ll bb) { if(aa==bb)return ; ll besar=(bb-aa+1),ii; string z; for(ii=0;ii<N;ii++)z+="1"; for(ii=aa;ii<=bb;ii++)z[ii]='0'; for(ii=aa;ii<aa+(besar/2);ii++) { z[ii]='1'; add_element(z); //cout<<z<<"\n"; z[ii]='0'; } buat(aa,aa+besar/2-1); buat(aa+besar/2,bb); } void cari(ll aa,ll bb,string cc) { //cout<<aa<<" "<<bb<<" "<<cc<<"\n"; ll ii; if(aa==bb) { for(ii=0;ii<N;ii++) if(cc[ii]=='0') { a[ii]=aa; return ; } return ; } string ki=cc; string ka=cc; string tan=cc; ll besar=(bb-aa+1); for(ii=0;ii<N;ii++) if(cc[ii]=='0') { tan[ii]='1'; if(check_element(tan))ka[ii]='1'; else ki[ii]='1'; tan[ii]='0'; } cari(aa,aa+besar/2-1,ki); cari(aa+besar/2,bb,ka); } std::vector<int> restore_permutation(int n, int w, int r) { N=n; buat(0,n-1); compile_set(); for(i=0;i<n;i++)s+="0"; cari(0,n-1,s); vector<int> has(n); for(i=0;i<n;i++) has[i]=a[i]; return has; }
#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...