제출 #71396

#제출 시각아이디문제언어결과실행 시간메모리
71396hamzqq9Unscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
4 ms512 KiB
#include "messy.h" #include<bits/stdc++.h> #define st first #define nd second #define pb push_back #define ppb pop_back #define umax(x,y) x=max(x,y) #define umin(x,y) x=min(x,y) #define ll long long #define ii pair<int,int> #define iii pair<int,ii> #define sz(x) ((int) x.size()) #define orta ((bas+son)>>1) #define all(x) x.begin(),x.end() #define dbgs(x) cerr<<(#x)<<" --> "<<(x)<<" " #define dbg(x) cerr<<(#x)<<" --> "<<(x)<<endl;getchar() #define pw(x) (1<<(x)) #define inf 2000000000 #define MOD 1000000007 #define N 55 #define MAX 10000006 #define LOG 30 #define KOK 200 using namespace std; int n; void find(int bas,int son,vector<int> match,vector<int>& p) { string wask(n,'1'); if(bas+1==son) { wask[match[1]]='0'; if(check_element(wask)) { p[match[0]]=bas; p[match[1]]=son; } else { p[match[1]]=bas; p[match[0]]=son; } return ; } for(int i:match) wask[i]='0'; vector<int> lmatch,rmatch; for(int i=0;i<sz(match);i++) { wask[match[i]]='1'; if(check_element(wask)) { lmatch.pb(match[i]); } else { rmatch.pb(match[i]); } wask[match[i]]='0'; } find(bas,orta,lmatch,p); find(orta+1,son,rmatch,p); } void add(int bas,int son) { if(bas==son) return ; string wadd(n,'1'); for(int i=bas;i<=son;i++) wadd[i]='0'; for(int i=bas;i<=orta;i++) { wadd[i]='1'; add_element(wadd); wadd[i]='0'; } add(bas,orta); add(orta+1,son); } vector<int> restore_permutation(int n, int w, int r) { ::n=n; add(0,n-1); compile_set(); vector<int> match,p(n); for(int i=0;i<n;i++) match.pb(i); find(0,n-1,match,p); return p; }
#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...