Submission #65960

#TimeUsernameProblemLanguageResultExecution timeMemory
65960gs13068Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
4 ms512 KiB
#include <vector> #include <cstdio> #include <string> #include "messy.h" using namespace std; int N; int R[128]; void push(int l, int r) { if (r - l == 1) return; string s(N, '0'); int i; for (i = l; i < r; i++) s[i] = '1'; for (i = l; i < (l + r >> 1); i++) { s[i] = '0'; add_element(s); s[i] = '1'; } push(l, l + r >> 1); push(l + r >> 1, r); } void pop(vector<int> a, int k) { if (a.size() == 1) { R[a[0]] = k; return; } string s(N, '0'); vector<int> l, r; for (auto t : a) s[t] = '1'; for (auto t : a) { s[t] = '0'; if (check_element(s)) l.push_back(t); else r.push_back(t); s[t] = '1'; } pop(l, k); pop(r, k | r.size()); } std::vector<int> restore_permutation(int n, int w, int r) { vector<int> res; int i; N = n; push(0, n); compile_set(); for (i = 0; i < n; i++) res.push_back(i); pop(res, 0); return vector<int>(R, R + n); }

Compilation message (stderr)

messy.cpp: In function 'void push(int, int)':
messy.cpp:16:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     for (i = l; i < (l + r >> 1); i++) {
                      ~~^~~
messy.cpp:21:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     push(l, l + r >> 1);
             ~~^~~
messy.cpp:22:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     push(l + r >> 1, r);
          ~~^~~
#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...