Submission #432006

#TimeUsernameProblemLanguageResultExecution timeMemory
432006davi_bartUnscrambling a Messy Bug (IOI16_messy)C++17
0 / 100
2 ms588 KiB
#pragma GCC optimize("O3") #include <bits/stdc++.h> #include "messy.h" using namespace std; #define ll long long #define fi first #define se second #define ld long double #define pb push_back int N; string operator+(string &a,string &b){ string c=a; for(int i=0;i<b.size();i++){ if(b[i]=='1')c[i]='1'; } return c; } std::vector<int> restore_permutation(int n, int w, int r){ N=n; for(int i=1;i<N;i*=2){ for(int j=0;j<N;j+=2*i){ string x=string(N,'0'); for(int h=j;h<j+i;h++)x[h]='1'; //cout<<x<<endl; add_element(x); } } compile_set(); vector<int> v[N+2]; vector<pair<string,int> > g1,g2; for(int i=0;i<N;i++){ string x=string(N,'0'); x[i]='1'; if(check_element(x)){ v[i].pb(1); g1.pb({x,i}); }else{ g2.pb({x,i}); } } for(int i=2;i<N;i*=2){ vector<pair<string,int> > g3,g4; for(auto [a,b]:g1){ for(auto [c,d]:g2){ string k=a+c; if(check_element(k)){ for(int j=b;j<b+i/2;j++)v[j].pb(i); for(int j=d;j<d+i/2;j++)v[j].pb(i); g3.pb({k,min(b,d)}); }else{ g4.pb({k,min(b,d)}); } } } g1=g3; g2=g4; } vector<int> ans(N); for(int i=0;i<N;i++){ int cur=0; for(int j:v[i])cur+=j; ans[i]=N-1-cur; } //reverse(ans.begin(),ans.end()); return ans; }

Compilation message (stderr)

messy.cpp: In function 'std::string operator+(std::string&, std::string&)':
messy.cpp:13:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |     for(int i=0;i<b.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...