제출 #649410

#제출 시각아이디문제언어결과실행 시간메모리
649410cadmiumskyA Difficult(y) Choice (BOI21_books)C++14
45 / 100
4 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) { cerr << "query: " << x << '\n'; 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(fmin(query(l + (1 << i))) < a) l += (1 << i); s--; } //cerr << fmin(query(l)) << '\n'; s = min(s, 24LL); int lim = (s + 1) / 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:37: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]
   37 |   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...