제출 #467854

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

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:27:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<long long int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |     for(int i=K; i<vals.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...