제출 #434944

#제출 시각아이디문제언어결과실행 시간메모리
434944dqhungdlA Difficult(y) Choice (BOI21_books)C++17
0 / 100
77 ms280 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; void solve(int N, int K, long long A, int S) { int l=K,r=N,pivot=-1; while(l<=r) { int mid=(l+r)/2; if(skim(mid)*K<=2*A) { pivot=mid; l=mid+1; } else r=mid-1; } if(pivot==-1) impossible(); vector<pair<int,int>> V; for(int i=max(1,pivot-9);i<=min(pivot+10,N);i++) V.push_back({skim(i),i}); for(int mask=0;mask<(1<<V.size());mask++) { int sum=0; for(int i=0;i<V.size();i++) if((mask>>i)&1) sum+=V[i].first; if(A<=sum&&sum<=2*A) { vector<int> rs; for(int i=0;i<V.size();i++) if((mask>>i)&1) rs.push_back(V[i].second); answer(rs); } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:24:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for(int i=0;i<V.size();i++)
      |               ~^~~~~~~~~
books.cpp:29:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |    for(int i=0;i<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...