제출 #395162

#제출 시각아이디문제언어결과실행 시간메모리
395162jeroenodbUnscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
1 ms404 KiB
#include "bits/stdc++.h" #include "messy.h" using namespace std; #define all(x) begin(x),end(x) template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #define debug(a) cerr << "(" << #a << ": " << a << ")\n"; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> pi; const int mxN = 1e5+1, oo = 1e9; std::vector<int> restore_permutation(int n, int w, int r) { assert(n==8); for(int i=1;i<n;++i) { add_element(string(i,'1')+string(n-i,'0')); } vi ans(n); iota(all(ans),0); compile_set(); vector<string> got(n); for(int i=0;i<1<<n;++i) { string query(n,'0'); int digs = 0; for(int j=0;j<n;++j) { if((i>>j) & 1) { query[j]++; digs++; } } if(check_element(query)) { got[digs] = query; } } for(int i=1;i<7;++i) { int nw = got[i].find('1',i-1); if(i-1!=nw) { swap(ans[i-1], ans[nw]); break; } } 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...