제출 #586188

#제출 시각아이디문제언어결과실행 시간메모리
586188Tien_NoobUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
2 ms468 KiB
//Make CSP great again //Vengeance #include <bits/stdc++.h> #include <messy.h> #define TASK "TESTCODE" #define Log2(x) 31 - __builtin_clz(x) using namespace std; string s; vector<int> res; void gen(int l, int r) { if (l == r) { return ; } fill(s.begin(), s.end(), '1'); fill(s.begin() + l, s.begin() + r + 1, '0'); int mid = (l + r)/2; for (int i = l; i <= mid; ++ i) { s[i] = '1'; add_element(s); s[i] = '0'; } //fill(s.begin() + mid + 1, s.end(), '1'); gen(l, mid); //fill(s.begin(), s.begin() + mid + 1, '1'); gen(mid + 1, r); } void DnC(int l, int r, vector<int> val) { fill(s.begin(), s.end(), '1'); for (int i : val) { s[i] = '0'; } if (l == r) { res[l] = val.front(); return ; } vector<int> L, R; int mid = (l + r)/2; for (int i : val) { s[i] = '1'; if (check_element(s)) { L.push_back(i); } else { R.push_back(i); } s[i] = '0'; } /*for (int i : R) { s[i] = '1'; }*/ DnC(l, mid, L); /*for (int i : L) { s[i] = '1'; }*/ DnC(mid + 1, r, R); } vector<int> restore_permutation(int n, int w, int r) { s.resize(n); res.resize(n); gen(0, n - 1); compile_set(); vector<int> tmp(n); iota(tmp.begin(), tmp.end(), 0); DnC(0, n - 1, tmp); return res; } /*void read() { //restore_permutation(8, 10, 10); //s.resize(8); //gen(0,7); } void solve() { } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); //freopen(TASK".OUT", "w", stdout); } int t = 1; bool typetest = false; if (typetest) { cin >> t; } for (int __ = 1; __ <= t; ++ __) { //cout << "Case " << __ << ": "; read(); solve(); } }*/
#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...