제출 #742464

#제출 시각아이디문제언어결과실행 시간메모리
742464boyliguanhanUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
3 ms468 KiB
#include <vector> #define PB push_back #define For(i,j,k,l) for(int i = j; i < k; i+=l) #define Rfor(i,j) for(auto i: j) #include "messy.h" #define clr(x) l[x*2]=l[x],R[x*2+1]=R[x],R[x*2]=l[x]+R[x]>>1,l[x*2+1]=R[x*2]+1; using namespace std; #define N 520 int l[N], R[N], dis[N]; vector<int> pos[N]; std::vector<int> restore_permutation(int n, int w, int r) { R[1] = n-1, R[0] = -1; For(i,1,n,1) clr(i); For(i, 2, 2*n,2) { if(i>2) dis[i] = i-1; string str(n, '0'); For(j, l[dis[i]], 1+R[dis[i]],1) str[j] = '1'; For(j,l[i],1+R[i],1) { string str2 = str; str2[j] = '1'; add_element(str2); } } compile_set(); For(i,0,n,1) pos[1].PB(i); For(i,2,2*n,2) { string str(n, '0'); Rfor(j,pos[dis[i]]) str[j] = '1'; Rfor(j,pos[i/2]) { string str2=str; str2[j] = '1'; if(check_element(str2)) pos[i].PB(j); else pos[i+1].PB(j); } } vector<int> res(n); For(i,n,2*n,1) res[pos[i][0]] = i-n; return res; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:6:53: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
    6 | #define clr(x) l[x*2]=l[x],R[x*2+1]=R[x],R[x*2]=l[x]+R[x]>>1,l[x*2+1]=R[x*2]+1;
      |                                                 ~~~~^~~~~
messy.cpp:13:18: note: in expansion of macro 'clr'
   13 |     For(i,1,n,1) clr(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...