제출 #1023318

#제출 시각아이디문제언어결과실행 시간메모리
1023318vjudge1Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
2 ms632 KiB
#include <bits/stdc++.h> using namespace std; void add_element(std::string x); bool check_element(std::string x); void compile_set(); int n; int i, j; vector<int> ans; string get(int l, int r){ string s = string(n, '0'); for(int i = l; i <= r; i++) s[i] = '1'; return s; } void calc1(int l = 0, int r = n - 1){ if(l == r) return; int mid = (l + r) >> 1; string s = get(l, r); for(int i = l; i <= mid; i++){ s[i] = '0'; add_element(s); s[i] = '1'; } calc1(l, mid); calc1(mid+1, r); } void calc2(vector<int> v, int l = 0, int r = n - 1){ if(l == r) ans[v.back()] = l; else{ int mid = (l + r) >> 1; vector<int> vl, vr; string s(n, '0'); for(int i: v) s[i] = '1'; for(int i: v){ s[i] = '0'; if(check_element(s)) vl.push_back(i); else vr.push_back(i); s[i] = '1'; } calc2(vl, l, mid); calc2(vr, mid+1, r); } } vector<int> restore_permutation(int N, int w, int r){ n = N; ans = vector<int>(n, 0); vector<int> v; for(int i = 0; i < n; i++){ v.push_back(i); } calc1(); compile_set(); calc2(v); return ans; }

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

messy.cpp: In function 'void calc2(std::vector<int>, int, int)':
messy.cpp:41:4: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   41 |    else vr.push_back(i); s[i] = '1';
      |    ^~~~
messy.cpp:41:26: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   41 |    else vr.push_back(i); s[i] = '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...