Submission #551931

#TimeUsernameProblemLanguageResultExecution timeMemory
551931Blobo2_Blobo2A Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //#include "grader.cpp" #include "books.h" #define int long long #define endl "\n" #define all(v) v.begin(),v.end() #define gen(arr,n,nxt) generate(arr,arr+n,nxt) #define Blobo2 ios_base::sync_with_stdio(false);cin.tie(0); using namespace std; int dp[(1<<20)+5]; void solve(int32_t n, int32_t k, int a, int32_t S) { int s=0,e = n-1; while(s<=e){ int mid = (s+e)/2; int x = skim(mid+1); if(x >= A)e=mid-1; else s=mid+1; } int arr[2*k+1][2]; memset(arr,-1,sizeof arr); for(int i=0;i<k;i++) arr[i][0] = skim(i+1),arr[i][1] = i+1; for(int i = s-1,j = k;i>=max(0ll,s-k);j++,i--) arr[j][0] = skim(i+1),arr[j][1]=i+1; int cnt = 0; for(int i=0;i<k;i++) cnt += arr[i][0]; if(cnt > 2*a) impossible(); for(int i=1;i<=(1<<(2*k));i++){ if(__builtin_popcount(i) == k){ cnt=0; for(int j=0;j<=2*k;j++){ if(i&(1<<j)){ if(arr[j][0] == -1) goto tooo; cnt += arr[j][0]; } } if(cnt >= a && cnt <= a*2){ vector<int32_t>v; for(int j=0;j<=2*k;j++){ if(i&(1<<j)) v.push_back(arr[j][1]); } answer(v); } } tooo:; } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int32_t, int32_t, long long int, int32_t)':
books.cpp:17:17: error: 'A' was not declared in this scope
   17 |         if(x >= A)e=mid-1;
      |                 ^