제출 #649448

#제출 시각아이디문제언어결과실행 시간메모리
649448cadmiumskyA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms312 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; int liml = a, limr = 2 * a; while(k > 0 && query(n) < liml) { liml -= query(n); limr -= query(n); k--; sol.push_back(n); n--; } if(k == 0) impossible(); int sum = 0; for(int i = 1; i < k; i++) sol.push_back(i), sum += query(i); int lim = liml - sum; int l = k - 1; for(int i = 16; i >= 0; i--) { if(l + (1 << i) > n) continue; if(query(l + (1 << i)) < lim) l += (1 << i); } //cerr << a - sum << ' ' << query(l) << '\n'; l++; if(l > n) impossible(); sol.push_back(l); sum += query(l); if(!(liml <= sum && sum <= limr)) impossible(); answer(sol); }

컴파일 시 표준 에러 (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...