Submission #95687

#TimeUsernameProblemLanguageResultExecution timeMemory
95687rocketninja7Unscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
3 ms384 KiB
#include <vector> #include <string> using namespace std; #include "messy.h" vector<int> restore_permutation(int n, int w, int r) { string s="1"; for(int i=1;i<n;i++){ s+='0'; } add_element(s); for(int i=1;i<n;i++){ s=""; for(int j=0;j<n;j++){ if(j==i-1||j==i){ s+='1'; } else{ s+='0'; } } } compile_set(); vector<int> ans; for(int i=0;i<n;i++){ s=""; for(int j=0;j<n;j++){ if(j==i){ s+='1'; } else{ s+='0'; } } if(check_element(s)){ ans.push_back(i); break; } } bool checks[n][n]; for(int i=0;i<n;i++){ for(int j=i+1;j<n;j++){ s=""; for(int k=0;k<n;k++){ if(k==i||k==j){ s+='1'; } else{ s+='0'; } } checks[i][j]=checks[j][i]=check_element(s); } } for(int i=1;i<n;i++){ for(int j=0;j<n;j++){ if(j==ans[i-1]){ continue; } if(checks[ans[i-1]][j]){ ans.push_back(j); 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...