Submission #808638

#TimeUsernameProblemLanguageResultExecution timeMemory
808638AlphaBruhUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
2 ms500 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; int n=128; string all_zero=""; vector<int>to(128,0); void build(int l=0 , int r=n-1, string base=all_zero){ if(l==r) return; int mid = (l+r)>>1; for(int i = l; i <= mid; i++){ string tmp = base; tmp[i]='1'; add_element(tmp); } string lft_base=base,rgt_base=base; for(int i = l; i <= mid; i++){ rgt_base[i]='1'; } for(int i = mid+1; i <= r; i++){ lft_base[i]='1'; } build(l,mid,lft_base); build(mid+1,r,rgt_base); return; } void slv(vector<int>prge,int l=0 , int r=n-1, string base=all_zero){ if(l==r){ to[l]=prge[0]; return; } int mid = (l+r)>>1; vector<int>inlft; vector<int>inrgt; for(int i = 0; i < prge.size(); i++){ int ploc = prge[i]; string tmp = base; tmp[ploc]='1'; bool isq = check_element(tmp); if(isq==0){ inrgt.push_back(ploc); } else{ inlft.push_back(ploc); } } string lft_base=base,rgt_base=base; for(int loc : inrgt){ lft_base[loc]='1'; } for(int loc : inlft){ rgt_base[loc]='1'; } slv(inlft,l,mid,lft_base); slv(inrgt,mid+1,r,rgt_base); return; } vector<int> restore_permutation(int N, int W, int R) { n = N; to.assign(n,0); for(int i = 0; i < n; i++){ all_zero=all_zero+"0"; } build(); compile_set(); vector<int>srge(n,0); for(int i = 0; i < n; i++) srge[i]=i; slv(srge); vector<int>rt(n,0); for(int i = 0; i < n; i++){ rt[to[i]]=i; } return rt; }

Compilation message (stderr)

messy.cpp: In function 'void slv(std::vector<int>, int, int, std::string)':
messy.cpp:34:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for(int i = 0; i < prge.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...