제출 #649432

#제출 시각아이디문제언어결과실행 시간메모리
649432cadmiumskyA Difficult(y) Choice (BOI21_books)C++14
0 / 100
3 ms336 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; using ll = long long; const int nmax = 1e5 + 5; namespace QUERY { ll v[nmax]; set<int> ind; ll query(int x) { if(v[x] == 0) { v[x] = skim(x); ind.insert(x); } return v[x]; } } ll n, k, a, s; ll fmin(ll x) { return x * k + k * (k - 1) / 2; } ll fmax(ll x) { return x * k - k * (k - 1) / 2; } using namespace QUERY; #define list shsflkhsdsdhsd vector<ll> list; vector<int> sol; void mksolve(int lp, ll sum = 0) { if(sum > 2 * a) return; if(sol.size() == k) { if(sum >= a) { answer(sol); } return; } lp++; for(int i = lp; i + k - sol.size() <= list.size(); i++) { sol.push_back(list[i]); sum += v[list[i]]; mksolve(i, sum); sol.pop_back(); sum -= v[list[i]]; } return; } void solve(int _N, int _K, long long _A, int _S) { n = _N; k = _K; a = _A; s = _S; s = min(40LL, s); int l = 0; for(int i = 16; i >= 0; i--) { if(l + (1 << i) > n) continue; if(fmax(query(l + (1 << i))) < a) l += (1 << i); s--; } l++; s = min(s, 25LL); if(query(l) - query(l - 1) > a) { for(int i = 1; i <= n && s > 0; s--, i++) query(i), list.push_back(i); } else { int lim = (s + 3) / 2; //cerr << lim << ' ' << s << '\n'; for(int i = l; i > 0 && lim > 0; s--, i--, lim--) list.push_back(i), query(i); for(int i = max(1, l); s > 0 && i <= n; i++, s--) list.push_back(i), query(i); } sort(list.begin(), list.end()); list.resize(unique(list.begin(), list.end()) - list.begin()); sol.reserve(40); mksolve(-1); impossible(); }

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

books.cpp: In function 'void mksolve(int, ll)':
books.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   36 |   if(sol.size() == k) {
      |      ~~~~~~~~~~~^~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...