Submission #587201

#TimeUsernameProblemLanguageResultExecution timeMemory
587201stevancvUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
3 ms488 KiB
#include <bits/stdc++.h> #include "messy.h" #define ll long long #define ld long double #define sp ' ' #define en '\n' #define smin(a, b) a = min(a, b) #define smax(a, b) a = max(a, b) using namespace std; string s; void Add(int l, int r) { if (l == r) return; int mid = l + r >> 1; for (int i = l; i <= r; i++) s[i] = '1'; for (int i = l; i <= mid; i++) { s[i] = '0'; add_element(s); s[i] = '1'; } for (int i = l; i <= r; i++) s[i] = '0'; Add(l, mid); Add(mid + 1, r); } vector<int> ans; void Solve(int l, int r, vector<int> v) { if (l == r) {ans[v[0]] = l; return;} vector<int> x, y; int mid = l + r >> 1; for (int i : v) s[i] = '1'; for (int i : v) { s[i] = '0'; if (check_element(s)) x.push_back(i); else y.push_back(i); s[i] = '1'; } for (int i : v) s[i] = '0'; Solve(l, mid, x); Solve(mid + 1, r, y); } vector<int> restore_permutation(int n, int w, int r) { for (int i = 0; i < n; i++) s += "0"; Add(0, n - 1); compile_set(); vector<int> v(n); iota(v.begin(), v.end(), 0); ans.resize(n); Solve(0, n - 1, v); return ans; }

Compilation message (stderr)

messy.cpp: In function 'void Add(int, int)':
messy.cpp:13:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   13 |     int mid = l + r >> 1;
      |               ~~^~~
messy.cpp: In function 'void Solve(int, int, std::vector<int>)':
messy.cpp:28:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   28 |     int mid = 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...