Submission #95717

#TimeUsernameProblemLanguageResultExecution timeMemory
95717rocketninja7Unscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
3 ms512 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'; } } add_element(s); } 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]||(i>1&&j==ans[i-2])){ continue; } if(checks[ans[i-1]][j]){ ans.push_back(j); break; } } } vector<int> temp(n); for(int i=0;i<n;i++){ temp[ans[i]]=i; } return temp; }
#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...