Submission #138150

#TimeUsernameProblemLanguageResultExecution timeMemory
138150HassoonyUnscrambling a Messy Bug (IOI16_messy)C++17
49 / 100
3 ms380 KiB
#include <bits/stdc++.h> #include "messy.h" //#include "grader.cpp" using namespace std; typedef long long ll; const int MX=1000; int ans[MX],ans1[MX],vis[MX]; vector<int> restore_permutation(int n, int w, int r) { string tmp=""; for(int i=0;i<n;i++)tmp+="0"; for(int i=0;i<n;i++){ tmp[i]='1'; add_element(tmp); } for(int i=0;i<n;i++)ans[i]=i; compile_set(); string Cur=""; for(int i=0;i<n;i++)Cur+="0"; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(Cur[j]=='1')vis[j]=1; else vis[j]=0; } while(1){ int j=rand()%n; if(vis[j])continue; vis[j]=1; if(Cur[j] == '1')continue; Cur[j]='1'; if(check_element(Cur)){ ans[i]=j; break; } Cur[j]='0'; } } vector<int>v; for(int i=0;i<n;i++)ans1[ans[i]]=i; for(int i=0;i<n;i++)v.push_back(ans1[i]); return v; }
#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...