제출 #282614

#제출 시각아이디문제언어결과실행 시간메모리
282614Atill83Unscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
3 ms544 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int cnt = 0; void gen(int n, int l, int r){ if(l > r || l == r) return; string s; for(int i = 0; i < n; i++){ s += '1'; } int m = (l + r) / 2; for(int i = l; i <= r; i++){ s[i] = '0'; } for(int i = l; i <= m; i++){ s[i] = '1'; cnt++; //cerr<<s<<endl; add_element(s); s[i] = '0'; } gen(n, l, m); gen(n, m + 1, r); } vector<int> ans; void solve(int n, int l, int r, vector<int> ind){ string s; if(l == r){ ans[ind[0]] = l; return; } for(int i = 0; i < n; i++){ s += "1"; } int m = (l + r) / 2; for(int i = 0; i < ind.size(); i++) s[ind[i]] = '0'; vector<int> a, b; for(int i = 0; i < ind.size(); i++){ s[ind[i]] = '1'; if(check_element(s)){ a.push_back(ind[i]); }else{ b.push_back(ind[i]); } s[ind[i]] = '0'; } assert(a.size() == ind.size() / 2); assert(b.size() == ind.size() / 2); solve(n, l, m, a); solve(n, m + 1, r, b); } vector<int> restore_permutation(int n, int w, int r) { ans.resize(n, 0); gen(n, 0, n - 1); compile_set(); vector<int> cur; for(int i = 0; i < n; i++){ cur.push_back(i); } solve(n, 0, n - 1, cur); return ans; }

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

messy.cpp: In function 'void solve(int, int, int, std::vector<int>)':
messy.cpp:41:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for(int i = 0; i < ind.size(); i++)
      |                    ~~^~~~~~~~~~~~
messy.cpp:46:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int i = 0; i < ind.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...