Submission #475941

#TimeUsernameProblemLanguageResultExecution timeMemory
475941AdamGSUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
2 ms460 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; typedef long double ld; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() vector<int>restore_permutation(int n, int w, int r) { string s=""; rep(i, n) s+="0"; for(int i=1; i<n; i*=2) { rep(j, n) if(j&i) { if(s[j]=='1') s[j]='0'; else s[j]='1'; add_element(s); if(s[j]=='1') s[j]='0'; else s[j]='1'; } s=""; rep(j, n) { if(j&i) s+="1"; else s+="0"; } } compile_set(); vector<int>ans(n); s=""; rep(i, n) s+="0"; for(int i=1; i<n; i*=2) { string p=""; rep(j, n) { if(s[j]=='1') s[j]='0'; else s[j]='1'; if(check_element(s)) { ans[j]+=i; p+="1"; } else p+="0"; if(s[j]=='1') s[j]='0'; else s[j]='1'; } s=p; } return ans; }
#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...