Submission #1169211

#TimeUsernameProblemLanguageResultExecution timeMemory
1169211zaki98A Difficult(y) Choice (BOI21_books)C++20
0 / 100
1 ms416 KiB
#include "bits/stdc++.h"
#include "books.h"
#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;
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();return;}
  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();return;}
  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();
  }
}
#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...