Submission #260213

#TimeUsernameProblemLanguageResultExecution timeMemory
260213mjkocijanUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
2 ms640 KiB
#include <vector> #include <bits/stdc++.h> #include "messy.h" using namespace std; typedef long long ll; typedef pair<ll, ll> ii; #define X first #define Y second #define pb push_back int k[10][200]; vector<int> reza; std::vector<int> restore_permutation(int n, int w, int r) { //add_element("0"); //compile_set(); //check_element("0"); reza.resize(n); string s(n, '0'); for (int i = 0; i < n / 2; i++) { s[i] = '1'; add_element(s); s[i] = '0'; } for (int m = n / 2; m >= 2; m /= 2) { string t(n, '1'); for (int i = 0; i < n; i += m) { for (int j = i; j < i + m; j++) { t[j] = '0'; } for (int j = i; j < i + m / 2; j++) { t[j] = '1'; add_element(t); t[j] = '0'; } for (int j = i; j < i + m; j++) { t[j] = '1'; } } } compile_set(); int i1 = 0, i2 = n / 2; for (int i = 0; i < n; i++) { s[i] = '1'; if (!check_element(s)) { k[0][i1] = i; reza[i] |= n / 2; i1++; } else { k[0][i2] = i; i2++; } s[i] = '0'; } int kk = 1; for (int m = n / 2; m >= 2; m /= 2) { string t(n, '1'); for (int i = 0; i < n; i += m) { for (int j = i; j < i + m; j++) { t[k[kk - 1][j]] = '0'; } i1 = i; i2 = i + m / 2; for (int j = 0; j < n; j++) { if (t[j] == '1') continue; t[j] = '1'; if (!check_element(t)) { k[kk][i1] = j; reza[j] |= m / 2; i1++; } else { k[kk][i2] = j; i2++; } t[j] = '0'; } for (int j = i; j < i + m; j++) { t[k[kk - 1][j]] = '1'; } } kk += 1; } return reza; //return std::vector<int>(); }
#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...