Submission #434944

#TimeUsernameProblemLanguageResultExecution timeMemory
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(); }

Compilation message (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...