Submission #399061

#TimeUsernameProblemLanguageResultExecution timeMemory
399061teehandsomeUnscrambling a Messy Bug (IOI16_messy)C++11
38 / 100
2 ms460 KiB
#include "messy.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define endl '\n' #define INF 1e9+7 #define all(x) x.begin(),x.end() using namespace std; using namespace __gnu_pbds; using ll=long long; using pii=pair<int,int>; using ppi=pair<int,pii>; using oset=tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>; template<typename T> void _print(vector<T> x) {cerr<<"{"; for(auto e:x) cerr<<e<<","; cerr<<"}";} void _print(pii x) {cerr<<"{"<<x.first<<","<<x.second<<"}";} template<typename T> void _print(T x) {cerr<<x;} void dbg() {cerr<<endl;} template<typename Head,typename... Tail> void dbg(Head H,Tail... T) { _print(H); if(sizeof...(T)) cerr<<","; else cerr<<"\"]"; dbg(T...); } #define debug(...) cerr<<"["<<#__VA_ARGS__<<"]:[\"",dbg(__VA_ARGS__) //mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); std::vector<int> restore_permutation(int n, int w, int r) { vector<int> ans(n,-1); string zero(n,'0'); string one=""; for(int i=0;i<n;i++) { one.push_back('1'); zero.pop_back(); // debug(one+zero); add_element(one+zero); } compile_set(); for(int i=0;i<n;i++) { string temp(n,'0'); for(int j=0;j<i;j++) { temp[ans[j]]='1'; } // debug(i,temp); for(int j=0;j<n;j++) { if(temp[j]=='0') { temp[j]='1'; bool res=check_element(temp); if(res) { // debug(temp); ans[i]=j; break; } temp[j]='0'; } } } vector<int> ans_real(n); for(int i=0;i<n;i++) { ans_real[ans[i]]=i; } return ans_real; }
#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...