제출 #1073797

#제출 시각아이디문제언어결과실행 시간메모리
10737974QT0RUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
2 ms604 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> odp; void build(int l, int p, int n){ if (l==p)return; string s; for (int i = 0; i<n; i++)s+='1'; for (int i = l; i<=p; i++){ s[i]='0'; } int md=(l+p)/2; for (int i = l; i<=md; i++){ s[i]='1'; add_element(s); s[i]='0'; } build(l,md,n); build(md+1,p,n); } void reconstruct(int l, int p, int n, vector<int> podz){ if (l==p){ odp[podz[0]]=l; return; } string s; for (int i = 0; i<n; i++)s+='1'; for (auto u : podz)s[u]='0'; vector<int> lewo,prawo; for (auto u : podz){ s[u]='1'; if (check_element(s))lewo.push_back(u); else prawo.push_back(u); s[u]='0'; } reconstruct(l,(l+p)/2,n,lewo); reconstruct((l+p)/2+1,p,n,prawo); } vector<int> restore_permutation(int n, int w, int r){ odp.resize(n); build(0,n-1,n); compile_set(); vector<int> wszystko; for (int i = 0; i<n; i++)wszystko.push_back(i); reconstruct(0,n-1,n,wszystko); return odp; }
#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...