제출 #308417

#제출 시각아이디문제언어결과실행 시간메모리
308417kylych03Unscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
9 ms512 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; //#include "grader.cpp" int N; vector <int> res; void add (int l , int r){ if(l==r) return; string s; for(int i = 0 ; i < N; i++) s=s+'1'; for(int i = l ; i <= r ;i++) s[i]='0'; int mid = (l+r)/2; for( int i = l ; i <= mid; i++){ s[i]='1'; add_element(s); s[i]='0'; } add(l, mid); add(mid+1, r); } void check(int l, int r, vector <int> vec){ if(l==r){ res[vec[0]] = l; return ; } string s; vector <int> left, right; for(int i = 0 ; i < N; i++) s=s+'1'; for(int i = 0 ; i <vec.size() ;i++) s[vec[i]]='0'; int mid = (l + r) / 2; for(int i = l ; i <= r; i++){ s[vec[i-l]]='1'; if(check_element(s)){ left.push_back(vec[i-l]); } else right.push_back(vec[i-l]); s[vec[i-l]]='0'; } check(l, mid,left); check( mid+1, r, right); } vector <int> restore_permutation(int n, int w, int r) { N = n; add(0, n-1); compile_set(); vector <int > vec; vec.resize(n); res.resize(n); for(int i = 0 ; i < n; i++) vec[i] = i; check( 0, n-1, vec); return res; }

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

messy.cpp: In function 'void check(int, int, std::vector<int>)':
messy.cpp:34:23: 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 <vec.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...