제출 #428023

#제출 시각아이디문제언어결과실행 시간메모리
428023mosiashvililukaA Difficult(y) Choice (BOI21_books)C++14
100 / 100
4 ms420 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,F[100009]; deque <long long> de; vector <int> vv; /*int skim(int q){ return F[q]; } void impossible(){ cout<<"-1"; } void answer(vector <int> q){ for(int h=0; h<q.size(); h++){ cout<<q[h]<<" "; } }*/ 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){ de.push_back(mid); answer(theend()); return; } //cout<<"KL"; 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(); } /*int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>a>>k>>A>>S; for(i=1; i<=a; i++){ cin>>F[i]; } for(i=1; i<a; i++){ if(F[i+1]<=F[i]){ cout<<"NOT SORTED"; exit(0); } } solve(a,k,A,S); return 0; }*/

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'std::vector<int> theend()':
books.cpp:20:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  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...