Submission #779218

#TimeUsernameProblemLanguageResultExecution timeMemory
779218vjudge1Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; #include "messy.h" string st(vector<int> s){ string a; for(auto i: s) a+=(char)('0'+i); return a; } void add(vector<int> s){ add_element(st(s)); } int check(vector<int> s){ return check_element(st(s)); } std::vector<int> restore_permutation(int n, int w, int r) { vector<int> s(n); s[0]=1; add(s); for(int i=1; i<n; i++){ s[i]=1; add(s); /*s[i-1]=0; for(int l=i+1; l<n; l++){ s[l]=1; add(s); s[l] = 0; } s[i-1] = 1;*/ } compile_set(); for(auto &i: s) i=0; vector<int> ans(n, -1); vector<int> t(n); for(int l=0; l<n; l++){ s=t; for(int i=0; i<n; i++){ if(s[i]==1) continue; s[i]=1; if(check(s)){ ans[i]=l; t[i]=1; break; } s[i]=0; } } for(int i=0; i<n; i++) if(ans[i]==-1) ans[i]=-1; 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...