제출 #974251

#제출 시각아이디문제언어결과실행 시간메모리
974251hirayuu_ojUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
10 ms636 KiB
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) #define all(x) x.begin(),x.end() using ll=long long; #include "messy.h" int mask(int x){ return (1<<x)-1; } std::vector<int> restore_permutation(int n, int w, int r) { vector<int> p(n,0); int b=0; while((1<<b)!=n)b++; rep(i,b){ rep(j,n){ if(!((j>>i)&1))continue; string s=""; rep(k,n){ if((j&mask(i))!=(k&mask(i))){ s=s+"1"; } else if(j==k){ s=s+"1"; } else{ s=s+"0"; } } add_element(s); } } compile_set(); rep(i,b){ rep(j,n){ string s=""; rep(k,n){ if((p[j]&mask(i))!=(p[k]&mask(i))){ s=s+"1"; } else if(j==k){ s=s+"1"; } else{ s=s+"0"; } } if(check_element(s)){ p[j]+=1<<i; } } } 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...