제출 #808687

#제출 시각아이디문제언어결과실행 시간메모리
808687ono_de206Unscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
1 ms468 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; #define in insert #define all(x) x.begin(),x.end() #define pb push_back #define eb emplace_back #define ff first #define ss second //#define int long long typedef long long ll; typedef vector<int> vi; typedef set<int> si; typedef multiset<int> msi; typedef pair<int, int> pii; typedef vector<pii> vpii; vector<int> ans; string str; void build(int l, int r) { if(l == r) { return; } int m = (l + r) >> 1; for(int i = l; i <= m; i++) { str[i] = '1'; add_element(str); str[i] = '0'; } for(int i = l; i <= m; i++) { str[i] = '1'; } build(m + 1, r); for(int i = l; i <= m; i++) { str[i] = '0'; } for(int i = m + 1; i <= r; i++) { str[i] = '1'; } build(l, m); } void find(int l, int r, vector<int> a) { if(a.size() != r - l + 1) return; if(l == r) { ans[l] = a[0]; return; } int m = (l + r) >> 1; vector<int> L, R; for(int i = l; i <= r; i++) { int x = a[i - l]; str[x] = '1'; if(check_element(str)) L.pb(x); else R.pb(x); str[x] = '0'; } for(int x : L) { str[x] = '1'; } find(m + 1, r, R); for(int x : L) { str[x] = '0'; } for(int x : R) { str[x] = '1'; } find(l, m, L); } vector<int> restore_permutation(int n, int w, int r) { vector<int> a(n); iota(all(a), 0); ans.resize(n); str = string(n, '0'); build(0, n - 1); compile_set(); str = string(n, '0'); find(0, n - 1, a); return ans; }

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

messy.cpp: In function 'void find(int, int, std::vector<int>)':
messy.cpp:47:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |  if(a.size() != r - l + 1) return;
      |     ~~~~~~~~~^~~~~~~~~~~~
#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...