제출 #389030

#제출 시각아이디문제언어결과실행 시간메모리
389030alishahali1382Unscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
3 ms472 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; typedef pair<int, int> pii; #define debug(x) {cerr<<#x<<"="<<x<<"\n";} #define debug2(x, y) {cerr<<#x<<", "<<#y<<" = "<<x<<", "<<y<<"\n";} #define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";} #define pb push_back #define all(x) x.begin(), x.end() const int inf=1000001000; const int N=128; vector<int> restore_permutation(int n, int w, int r){ string S, all0; for (int i=0; i<n; i++) all0+='0'; vector<int> A(n, 0); for (int bit=0; (1<<bit)<n; bit++){ for (int i=0; i<n; i++) if (i&(1<<bit)){ S=all0; S[i]='1'; if (bit){ for (int j=0; j<n; j++){ int x=(i&((1<<bit)-1)), y=(j&((1<<bit)-1)); if ((x^y)+1==(1<<bit)) S[j]='1'; } } add_element(S); // debug(S) } } // debug("compile") compile_set(); for (int bit=0; (1<<bit)<n; bit++){ for (int i=0; i<n; i++){ S=all0; S[i]='1'; if (bit){ for (int j=0; j<n; j++){ int x=(A[i]&((1<<bit)-1)), y=(A[j]&((1<<bit)-1)); if ((x^y)+1==(1<<bit)) S[j]='1'; } } // cerr<<bit<<" "<<i<<" "<<S<<"\n"; if (check_element(S)) A[i]|=(1<<bit); } // cerr<<"A: ";for (int i=0; i<n; i++) cerr<<A[i]<<" \n"[i==n-1]; } return A; }
#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...