제출 #889652

#제출 시각아이디문제언어결과실행 시간메모리
889652Jawad_Akbar_JJUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
1 ms348 KiB
#include <iostream> #include <vector> #include <cassert> #include <algorithm> #include "messy.h" using namespace std; const int N = 2e5 + 10; int sz; string ind(int j,string s){ s[j] = '1'; return s; } int per[N]; // string str[N]; // int cur = 1; // void add_element(string s){ // // cout<<s<<endl; // str[cur++] = s; // } // void compile_set(){ // // cout<<"compiling set"<<endl; // vector<int> v; // for (int i=1;i<=sz;i++) // v.push_back(i-1); // int k = 50000; // while (k--) // next_permutation(begin(v),begin(v) + sz/2); // k = 50000; // while (k--) // next_permutation(begin(v) + sz/2,end(v)); // for (int i : v) // cout<<i<<" "; // cout<<endl; // for (int i=1;i<cur;i++){ // string s = str[i]; // int k = 0; // for (int j : v) // s[k++] = str[i][j]; // str[i] = s; // // cout<<str[i]<<endl; // } // } // bool check_element(string s){ // // cout<<"asked "<<s<<endl; // for (int i=1;i<cur;i++) // if (str[i]==s) // return true; // return false; // } vector<int> restore_permutation(int n,int w,int r){ sz = n; string tool; for (int i=1;i<=n;i++) tool += '.'; string ask = tool; for (int i=n-1;i>=0;i--){ ask[i] = '1'; add_element(ask); } compile_set(); // cout<<"compiled successfully!"<<endl; for (int i=n-1;i>=0;i--){ for (int j=0;j<n;j++){ if (tool[j]=='1') continue; string s = ind(j,tool); bool b = check_element(s); if (b){ per[j] = i; tool = s; break; } } } vector<int> v; for (int i=0;i<n;i++) v.push_back(per[i]); return v; } // int main(){ // vector<int> v = restore_permutation(32,1,1); // for (int i : v) // cout<<i<<" "; // }
#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...