Submission #230363

#TimeUsernameProblemLanguageResultExecution timeMemory
230363achibasadzishviliUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
7 ms512 KiB
#include <bits/stdc++.h> #define ll int #define f first #define s second #define pb push_back using namespace std; #include "messy.h" vector<ll>P; ll nn; void ask(ll l , ll r){ if(l == r)return; string s = ""; for(int i=0; i<nn; i++) s += '0'; for(int i=0; i<nn; i++) if(i < l || i > r) s[i] = '1'; for(int i=l; i <= (l + r) / 2; i++){ s[i] = '1'; add_element(s); s[i] = '0'; } ask(l , (l + r) / 2); ask((l + r) / 2 + 1 , r); } void solve(vector<ll>x , vector<ll>y){ if(x.size() == 1){ P[y[0]] = x[0]; return; } string s = ""; for(int i=0; i<nn; i++) s += '1'; for(int i=0; i<y.size(); i++) s[y[i]] = '0'; vector<ll>v1 , v2 , x1 , x2; for(int i=0; i<y.size(); i++){ s[y[i]] = '1'; if(check_element(s)){ //cout << y[i] << '\n'; v1.pb(y[i]); } else v2.pb(y[i]); s[y[i]] = '0'; } for(int i=0; i<x.size(); i++) if(i < (int)x.size() / 2) x1.pb(x[i]); else x2.pb(x[i]); solve(x1 , v1); solve(x2 , v2); } vector<int> restore_permutation(int N, int w, int r){ nn = N; string s = ""; vector<ll>v1 , v2; for(int i=0; i<nn; i++){ v1.pb(i); v2.pb(i); } ask(0 , nn - 1); for(int i=0; i<nn; i++) P.pb(0); compile_set(); solve(v1 , v2); return P; }

Compilation message (stderr)

messy.cpp: In function 'void solve(std::vector<int>, std::vector<int>)':
messy.cpp:34:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<y.size(); i++)
                  ~^~~~~~~~~
messy.cpp:37:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<y.size(); i++){
                  ~^~~~~~~~~
messy.cpp:46:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<x.size(); i++)
                  ~^~~~~~~~~
#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...