제출 #88268

#제출 시각아이디문제언어결과실행 시간메모리
88268Retro3014Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
4 ms512 KiB
#include <vector> #include <string> #include "messy.h" using namespace std; string str; int N; vector<int> ans, arr, arr2; void init(){ for(int i=0; i<N; i++) str.push_back('0'); for(int i=0; i<N; i++) ans.push_back(0); for(int i=0; i<N; i++) arr.push_back(0); for(int i=0; i<N; i++) arr2.push_back(0); } void a(){ add_element(str); } void c(char ch){ for(int i=0; i<N; i++) str[i]=ch; } vector<int> restore_permutation(int n, int w, int r) { N=n; init(); n/=2; while(n>0){ for(int i=0; i<N; i+=2*n){ for(int j=i+n; j<i+2*n; j++){ c('1'); for(int k=i; k<i+2*n; k++){ str[k]='0'; } str[j]='1'; a(); } } n/=2; } compile_set(); n=N/2; while(n>0){ for(int j=0; j<N; j++){ c('1'); for(int k=0; k<N; k++){ if(arr[k]==arr[j]) str[k]='0'; } str[j]='1'; if(check_element(str)){ arr2[j]+=n; } } for(int i=0; i<N; i++){ arr[i]+=arr2[i]; arr2[i]=0; } n/=2; } return arr; }
#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...