Submission #649403

#TimeUsernameProblemLanguageResultExecution timeMemory
649403activedeltorreA Difficult(y) Choice (BOI21_books)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; // void solve(int N,int K,long long A,int S) { int i,n,k,val; n=N; k=K; a=A; vector<int>vec; long long v[100005],suma=0,st,dr,mij; for(i=1;i<=k-1;i++) { v[i]=skim(i); suma=suma+v[i]; } if(suma>=A) { v[k]=skim(k); suma=suma+v[k]; if(suma>a*2) { impossible(); } else { for(i=1;i<=k;i++) { vec.push_back(i); } answer(vec); } } else { st=k; dr=n; sol=0; while(st<=dr) { mij=(st+dr)/2; val=skim(mij); if(val+suma<=2*a && val+suma>=a) { for(i=1;i<k;i++) { vec.push_back(i); } vec.push_back(mij); answer(vec); } else if(val+suma<a) { dr=mij-1; sol=mij; } else { st=mij+1; } } val=skim(k); v[k]=val; suma=suma+val; if(suma>=a && suma<=2*a) { for(i=1;i<=k;i++) { vec.push_back(i); } answer(vec); } for(i=1;i<=k;i++) { if(i>=sol) { impossible(); } suma=suma-v[i]; suma=suma+skim[sol-i+1]; if(suma>=a && suma<=2*a) { for(j=i+1;j<=k;j++) { vec.push_back(j); } for(j=1;j<=i;j++) { vec.push_back(sol-j+1); } answer(vec); } } impossible(); } }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:12:5: error: 'a' was not declared in this scope
   12 |     a=A;
      |     ^
books.cpp:41:9: error: 'sol' was not declared in this scope
   41 |         sol=0;
      |         ^~~
books.cpp:86:21: error: 'j' was not declared in this scope
   86 |                 for(j=i+1;j<=k;j++)
      |                     ^
books.cpp:90:21: error: 'j' was not declared in this scope
   90 |                 for(j=1;j<=i;j++)
      |                     ^