Submission #428006

#TimeUsernameProblemLanguageResultExecution timeMemory
428006mosiashvililukaA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms292 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; long long a,k,A,S,jm,f[100009],lef,rig,mid,i,j,ii,jj,zx,xc; deque <long long> de; vector <int> vv; vector <int> theend(){ vv.clear(); for(int h=0; h<de.size(); h++){ vv.push_back(de[h]); } return vv; } void solve(int N, int K, long long AA, int SS) { a=N;k=K;A=AA;S=SS; for(i=1; i<k; i++){ f[i]=skim(i); de.push_back(i); jm+=f[i]; } f[k]=skim(k); de.push_back(k);jm+=f[k]; if(jm>=A&&jm<=A*2){ answer(theend()); return; } if(jm>A*2){ impossible(); return; } jm-=f[k];de.pop_back(); lef=k;rig=a+1; while(1){ if(lef+1>=rig){ mid=lef; break; } mid=(lef+rig)/2; f[mid]=skim(mid); if(f[mid]+jm<=2*A){ lef=mid; }else{ rig=mid; } } if(jm+f[mid]>=A){ answer(theend()); return; } jm+=f[mid];de.push_front(mid); i=mid; for(j=k-1; j>=1; j--){ de.pop_back();jm-=f[j]; i--;f[i]=skim(i);jm+=f[i];de.push_front(i); if(jm>=A){ answer(theend()); return; } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'std::vector<int> theend()':
books.cpp:9:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(int h=0; h<de.size(); h++){
      |               ~^~~~~~~~~~
#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...