# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
241728 | 2020-06-25T11:28:46 Z | crossing0ver | Unscrambling a Messy Bug (IOI16_messy) | C++17 | 2000 ms | 384 KB |
#include <bits/stdc++.h> #include "messy.h" using namespace std; int X[500],L[500],R[500],IN[500]; vector<int> restore_permutation(int n, int w, int r) { int lg = log2(n); int l = -1; string s(n,'0'); for (int val = n/2;val;val/=2) { for (int i = l+1; i < n; i++) { if ( (i & ( val) ) == 0) { s[i] = '1'; //add_element(s); cout << s <<'\n'; s[i] = '0'; } } s[++l] = '1'; } compile_set(); for (int i = 0;i < n; i++) s[i] = '0'; vector<int> st; vector<int> not1; for (int i = 0; i < n; i++) not1.push_back(i); int val = n/2; int cnt = 0; for (int i = 0; i < n; i++) for (int j = 1; j < n; j*=2) X[i]^=(1 << j); while (val) { vector<int> v; for (int i = 0; i < n; i++) { s[i] = '1'; if (!IN[i] && check_element(s)){ v.push_back(i); X[i]^=val; not1.erase(find(not1.begin(),not1.end(),i)); } s[i] = '0'; } cnt++; vector<bool> vis(n+1); while (not1.size()) { int pos = rand()%not1.size(); bool flag = 0; for (int i : v) { int t = 4; int pos = rand()%not1.size(); s[pos] = 1; s[i] = 1; if (check_element(s)) { flag = 1; s[i] = pos; IN[i] = 1; break; } } if (flag) break; } } vector<int> ans; for (int i = 0;i < n; i++) ans.push_back(X[i]); } /* main(){ int n; cin >> n; restore_permutation(n,0,0); }*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2087 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2097 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2099 ms | 256 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2089 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2080 ms | 384 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |