제출 #546448

#제출 시각아이디문제언어결과실행 시간메모리
546448d4xnA Difficult(y) Choice (BOI21_books)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // #define ll long long void solve(int N, int K, long long A, int S) { // TODO implement this function // impossible() // answer() // puedo hacer S preguntas // hay N libros // ordenados de mayor a menor por precio // tengo que comprar K // y la suma tiene que ser >= A y <= A*2 int l = K; int r = N; while (l < r) { int mid = (l+r)/2; ll x = skim(mid); ll low = x + (mid-1)*1; ll high = x*mid; if (low < A && high > A*2) impossible(); else if (low < A && high <= A*2) { l = mid+1; } else { r = mid-1; } } vector<int> ans; for (int i = l - K + 1; i <= l; i++) ans.push_back(i); answer(ans); /* if (skim(2) == 42) { impossible(); } else { answer({1, 3}); } */ }
#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...