제출 #945208

#제출 시각아이디문제언어결과실행 시간메모리
945208PenguinsAreCuteUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
1 ms604 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; void preDnc(int n, int l, int r) { string x; for(int i=0;i<n;i++) x+=char((i<l||i>=r)|48); int m = l+r>>1; for(int i=l;i<m;i++) { x[i]='1'; add_element(x); x[i]='0'; } if(r-l>2) { preDnc(n,l,m); preDnc(n,m,r); } } void postDnc(int n, int l, int r, vector<int> &perm) { vector<int> v(begin(perm)+l,begin(perm)+r); string x; for(int i=0;i<n;i++) x+='1'; for(auto i:v) x[i]='0'; int m = l+r>>1; int cur = l, cur2 = m; for(auto i: v) { x[i] = '1'; if(check_element(x)) perm[cur++]=i; else perm[cur2++]=i; x[i] = '0'; } if(r-l>2) { postDnc(n,l,m,perm); postDnc(n,m,r,perm); } } std::vector<int> restore_permutation(int n, int w, int r) { preDnc(n,0,n); compile_set(); vector<int> perm(n); iota(perm.begin(),perm.end(),0); postDnc(n,0,n,perm); return perm; }

컴파일 시 표준 에러 (stderr) 메시지

messy.cpp: In function 'void preDnc(int, int, int)':
messy.cpp:6:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    6 |  int m = l+r>>1;
      |          ~^~
messy.cpp: In function 'void postDnc(int, int, int, std::vector<int>&)':
messy.cpp:20:11: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   20 |  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...