Submission #709533

#TimeUsernameProblemLanguageResultExecution timeMemory
709533ssenseUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
3 ms480 KiB
#include <bits/stdc++.h> #include "messy.h" #define startt ios_base::sync_with_stdio(false);cin.tie(0); typedef long long ll; using namespace std; #define vint vector<int> int ng, wg, rg; vector<int> anss; void get_range(int l, int r) { if(l == r){ return; } vector<string> ans; string now; for(int i = 0; i < ng; i++) { now.push_back('0'); } for(int i = 0; i < ng; i++) { if(i < l || i > r) { now[i] = '1'; } } for(int i = l; i <= (l+r)/2; i++) { now[i] = '1'; add_element(now); now[i] = '0'; } get_range(l, (l+r)/2); get_range((l+r)/2+1, r); } void get_ans(int l, int r, vector<int> idx) { if(l == r) { anss[idx[0]] = l; return; } string now; for(int i = 0; i < ng; i++) { now.push_back('1'); } for(auto x : idx) { now[x] = '0'; } vector<int> left, right; for(auto x : idx) { now[x] = '1'; if(check_element(now)) { left.push_back(x); } else { right.push_back(x); } now[x] = '0'; } get_ans(l, (l+r)/2, left); get_ans((l+r)/2+1, r, right); } vector<int> restore_permutation(int n, int w, int r) { ng = n; wg = w; rg = r; get_range(0, n-1); anss.resize(n); compile_set(); vector <int> idx; for (int i = 0; i < n; i++) { idx.push_back(i); } get_ans(0, n - 1,idx); return anss; }
#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...