제출 #1169197

#제출 시각아이디문제언어결과실행 시간메모리
1169197zaki98A Difficult(y) Choice (BOI21_books)C++20
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.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 solve(int, int, long long int, int)':
books.cpp:41:9: error: 'skim' was not declared in this scope
   41 |     if (skim(mid) < A) {
      |         ^~~~
books.cpp:50:8: error: 'impossible' was not declared in this scope
   50 |   else impossible();
      |        ^~~~~~~~~~
books.cpp:55:9: error: 'skim' was not declared in this scope
   55 |     if (skim(mid) > 2*A) {
      |         ^~~~
books.cpp:64:8: error: 'impossible' was not declared in this scope
   64 |   else impossible();
      |        ^~~~~~~~~~
books.cpp:70:5: error: 'answer' was not declared in this scope
   70 |     answer(ans);
      |     ^~~~~~
books.cpp:73:5: error: 'impossible' was not declared in this scope
   73 |     impossible();
      |     ^~~~~~~~~~
books.cpp: In function 'void iO()':
books.cpp:17:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     freopen("output.txt","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
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("input.txt","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~