제출 #933440

#제출 시각아이디문제언어결과실행 시간메모리
933440AtabayRajabliA Difficult(y) Choice (BOI21_books)C++17
0 / 100
0 ms472 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; const int sz = 1e5 + 5; int q[sz]; int get(int x) { if(q[x])return q[x]; return q[x] = skim(x); } void solve(int n, int k, long long a, int s) { int l = 1, r = n, ind = n + 1; while(l <= r) { int m = (l + r) >> 1; if(get(m) >= a)r = m - 1, ind = m; else l = m + 1; } if(ind < k)impossible(); vector<int> v; long long sum = 0; for(int i = 1; i <= k; i++) { v.push_back(i); sum += get(i); } if(sum - get(k) + get(ind) >= a && sum - get(k) + get(ind) <= 2 * a) { v.pop_back(); v.push_back(ind); answer(v); } if(sum > 2 * a)impossible(); for(int i = max(k + 1, ind - k + 1); i <= ind; i++) { v.push_back(i); } l = 0, r = k; for(int i = 0; i + k < v.size(); i++) { if(a <= sum && sum <= a * 2)break; sum -= get(v[l++]); sum += get(v[r++]); } if(a <= sum && sum <= a * 2) { vector<int> ans; while(l < r)ans.push_back(v[l++]); answer(ans); } else impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:48:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for(int i = 0; i + k < v.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...