Submission #773917

#TimeUsernameProblemLanguageResultExecution timeMemory
773917ZHIRDILBILDIZA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include"books.h" #define ll long long #define fi first #define se second using namespace std ; void solve(int n, int k, ll a, int s) { vector<int> ans ; ll x[n + 1] = {}, pref[n + 1] = {} ; for(int i = 1 ; i <= k ; i++) { x[i] = skim(i) ; pref[i] = pref[i - 1] + x[i] ; } if(pref[k] > 2ll * a) impossible() ; if(a <= pref[k] && pref[k] <= 2ll * a) { for(int i = 1 ; i <= k ; i++) ans.push_back(i) ; answer(ans) ; } ll l = 0, r = n + 1 ; while(l + 1 < r) { ll mid = (l + r) >> 1ll, num = x[mid] ; if(!num) { num = skim(mid) ; x[mid] = num ; } if(num < a)l = mid ; else r = mid ; } if(r < k)impossible() ; if(r != n + 1 && x[r] + pref[k - 1] <= 2ll * a) { for(int i = 1 ; i < k ; i++) ans.push_back(i) ; ans.push_back(r) ; answer(ans) ; } if(r == n + 1)r = n ; ll sum = pref[k] ; for(int i = 1 ; i <= k ; i++) ans.push_back(i) ; for(int j = r - k ; j < r ; j++) { if(!x[j])x[j] = skim(j) ; md.push_back(x[j]) ; } for(int j = k - 1 ; j > 0 ; j--) { sum -= d[j] ; sum += md[j] ; ans[j] = r - k + j ; if(a <= sum && sum <= 2ll * a) answer(ans) ; } impossible() ; } //4 часа

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:51:9: error: 'md' was not declared in this scope
   51 |         md.push_back(x[j]) ;
      |         ^~
books.cpp:55:16: error: 'd' was not declared in this scope
   55 |         sum -= d[j] ;
      |                ^
books.cpp:56:16: error: 'md' was not declared in this scope
   56 |         sum += md[j] ;
      |                ^~