#include "bits/stdc++.h"
#include "books.h"
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define pii pair<int,int>
#define pll pair<long long, long long>
// permutation of the last layer
#define LOO(i,a,b) for (int i = a; i <= b; i++)
#define max3(a, b, c) max(max(a, b), c)
#define min3(a, b, c) min(min(a, b), c)
using namespace std;
const ll MAX = 1e9 + 7;
void iO() {
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);
}
vector<int> make_sorted_index(vector<int> const& values) {
vector<int> index(values.size());
iota(index.begin(), index.end(), 0);
stable_sort(index.begin(), index.end(), [&values](int a, int b) { return values[a] < values[b]; } );
return index;
} // this function is so skibidi
ll iPow(ll x, unsigned int p)
{
if (p == 0) return 1;
if (p == 1) return x;
ll tmp = iPow(x, p/2);
if (p%2 == 0) return (tmp * tmp);
else return (((x * tmp)) * tmp);
}
void solve(int N, int K, long long A, int S) {
// we dont have to do binary search save scumming cuz kinda nice restraints fr;
int l = 1;
int r = N;
while (r>l) {
int mid = (l+r)/2;
if (skim(mid) < A) {
l = mid + 1;
}
else {
r = mid;
}
}
int bigger_thana = -1;
if (r==l) bigger_thana = l;
else impossible();
l = 1;
r = N;
while (r>l) {
int mid = (l+r)/2;
if (skim(mid) > 2*A) {
r = mid - 1;
}
else {
l = mid;
}
}
int smaller_thana = -1;
if (r==l) smaller_thana = l;
else impossible();
if (bigger_thana - smaller_thana + 1 >= K) {
vector<int> ans;
for (int i = smaller_thana; i <= smaller_thana + K; i++) {
ans.push_back(i);
}
answer(ans);
}
else {
impossible();
}
}
/* int solve() {
return 0;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// iO();
//pre_process();
int t = 1;
// cin >> t;
while (t--) {
solve();
// cout << flush;
}
} */
컴파일 시 표준 에러 (stderr) 메시지
books.cpp: In function 'void iO()':
books.cpp:18:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
18 | freopen("output.txt","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
books.cpp:19:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
19 | freopen("input.txt","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |