Submission #65293

#TimeUsernameProblemLanguageResultExecution timeMemory
65293mhndUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
4 ms640 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; const int N = 3e5+50; const ll oo = 1e18; const ll mod = 1e9+7; void go (int n, int l, int r) { if (l + 1 == r) return; int m = l + r >> 1; string s = ""; for (int i = 0; i < n; ++i) { s += '1'; } for (int i = l; i < r; ++i) { s[i] = '0'; } for (int i = l; i < m; ++i) { s[i] = '1'; add_element(s); s[i] = '0'; } go(n, l, m); go(n, m, r); } vector <int> v; void kill (int n, int l, int r, string no) { if (l + 1 == r) { for (int i = 0; i < n; ++i) { if (no[i] == '0') { v[i] = l; break; } } return; } string x = no, y = ""; for (int i = 0; i < n; ++i) { y += '1'; } for (int i = 0; i < n; ++i) { if (no[i] == '0') { no[i] = '1'; if (check_element(no)) { x[i] = '1'; y[i] = '0'; } no[i] = '0'; } } int m = l + r >> 1; kill(n, l, m, y); kill(n, m, r, x); } vector<int> restore_permutation(int N, int w, int r) { int n = N; go(n,0,n); compile_set(); v.resize(n); string a = ""; for(int i=0;i<n;i++)a += '0'; kill(n,0,n,a); return v; }

Compilation message (stderr)

messy.cpp: In function 'void go(int, int, int)':
messy.cpp:14:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   int m = l + r >> 1;
           ~~^~~
messy.cpp: In function 'void kill(int, int, int, std::__cxx11::string)':
messy.cpp:57:13: 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...