Submission #206970

#TimeUsernameProblemLanguageResultExecution timeMemory
206970autumn_eelUnscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
6 ms376 KiB
#include "messy.h" #include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef pair<int,int>P; vector<int> restore_permutation(int n, int w, int r) { if(n==8){ map<vector<string>,P>mp; vector<string>u={ "00001111", "00110011", "01010101", "10001111", "11001111", }; rep(i,n)for(int j=i+1;j<n;j++){ vector<string>v=u; for(auto&s:v)swap(s[i],s[j]); sort(v.begin(),v.end()); if(mp.count(v))abort(); mp[v]=P(i,j); } for(auto&s:u)add_element(s); compile_set(); vector<string>t; rep(i,1<<8){ string s; rep(j,8){ s+=(i>>j&1)+'0'; } if(check_element(s))t.push_back(s); } sort(t.begin(),t.end()); vector<int>ans(n);rep(i,n)ans[i]=i; P p=mp[t]; swap(ans[p.first],ans[p.second]); return ans; } return {}; }
#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...