제출 #558923

#제출 시각아이디문제언어결과실행 시간메모리
558923benson1029A Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; vector< pair<int,int> > v; vector<int> ans; void solve(int N, int K, long long A, int S) { int l = 1, r = N, mid; while(l<=r) { mid = (l+r)/2; if(skim(mid) <= A) l = mid+1; else r = mid-1; } for(int i=1; i<=min(K, l); i++) { v.push_back({skim(i), i}); } for(int i=max(K+1, l-K); i <= min(l, N); i++) { v.push_back({skim(i), i}); } for(int i=0; i<(1<<v.size()); i++) { if(__builtin_popcount(i) != K) continue; long long sum = 0; for(int j=0; j<v.size(); j++) { if((i>>j)%2) sum += v[j].first; } if(sum >= A && sum <= 2*A) { for(int j=0; j<v.size(); j++) { if((i>>j)%2) ans.push_back(v[j].second); } answer(ans); return; } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:26:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int j=0; j<v.size(); j++) {
      |                      ~^~~~~~~~~
books.cpp:30:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             for(int j=0; j<v.size(); j++) {
      |                          ~^~~~~~~~~
#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...