제출 #732956

#제출 시각아이디문제언어결과실행 시간메모리
732956PoonYaPat비스킷 담기 (IOI20_biscuits)C++14
0 / 100
16 ms824 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll qs[61],sum,bag; ll find(ll x) { if (x<0) return 0; if (x==0) return 1; if (x==1) return qs[0]; int k=-1; for (int i=59; i>0; --i) { if ((1ll<<i)<=x) { k=i; break; } } assert(k!=-1); return qs[k-1]+find(min(x-(1ll<<k),(sum/bag)-(1ll<<k))); } ll count_tastiness(ll X, vector<ll> a) { bag=X; sum=a[0]; if (a[0]>=bag) qs[0]=2; else qs[0]=1; for (int i=1; i<60; ++i) { if (i<a.size()) sum+=a[i]*(1ll<<i); qs[i]=find((1ll<<(i+1))-1); } return qs[59]; }

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

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if (i<a.size()) sum+=a[i]*(1ll<<i);
      |             ~^~~~~~~~~
#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...