Submission #71456

#TimeUsernameProblemLanguageResultExecution timeMemory
71456RezwanArefin01Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
4 ms640 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int n; vector<int> p; void add(int l, int r) { if(l == r) return; string base(n, '1'); int m = l + r >> 1; for(int i = l; i <= r; i++) base[i] = '0'; for(int i = l; i <= m; i++) { string s = base; s[i] = '1'; add_element(s); } add(l, m); add(m + 1, r); } void solve(int l, int r, vector<int> v) { if(l == r) { p[v[0]] = l; return; } int m = l + r >> 1; string base(n, '1'); vector<int> L, R; for(int i : v) base[i] = '0'; for(int i : v) { string s = base; s[i] = '1'; if(check_element(s)) L.push_back(i); else R.push_back(i); } solve(l, m, L); solve(m + 1, r, R); } vector<int> restore_permutation(int N, int w, int r) { n = N; add(0, n - 1); compile_set(); vector<int> v; for(int i = 0; i < n; i++) v.push_back(i); p = vector<int>(n, 0); solve(0, n - 1, v); return p; }

Compilation message (stderr)

messy.cpp: In function 'void add(int, int)':
messy.cpp:11:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     int m = l + r >> 1; 
             ~~^~~
messy.cpp: In function 'void solve(int, int, std::vector<int>)':
messy.cpp:24:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     } int m = l + r >> 1; 
               ~~^~~
#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...