제출 #805163

#제출 시각아이디문제언어결과실행 시간메모리
805163alvingogo비스킷 담기 (IOI20_biscuits)C++14
0 / 100
2 ms340 KiB
#include "biscuits.h" #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define fs first #define sc second #define p_q priority_queue using namespace std; typedef long long ll; ll count_tastiness(ll x, vector<ll> a) { { vector<ll> c(a.size()+1); for(int i=0;i<a.size();i++){ c[i+1]=a[i]; } a=c; } while(a.size()<=63){ a.push_back(0); } vector<ll> b=a; int n=a.size(); for(int i=1;i<n;i++){ b[i]+=b[i-1]/2; } vector<ll> dp(n),pre(n),cost(n); dp[0]=1; pre[0]=1; cost[0]=9e18; for(int i=1;i<n;i++){ if(b[i]<x){ dp[i]=0; pre[i]=pre[i-1]; cost[i]=-1; continue; } if(a[i]>=x){ dp[i]=pre[i-1]; pre[i]=2*dp[i]; cost[i]=b[i]-x; continue; } ll f=x-a[i]; for(int j=i-1;j>0;j--){ if(cost[j]>=0){ if(cost[j]/2>=f){ f*=2; f-=a[j]-x; if(j){ dp[i]+=pre[j-1]; } } } } dp[i]++; pre[i]=pre[i-1]+dp[i]; cost[i]=b[i]-x; } return pre[n-1]; }

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

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:13:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |   for(int i=0;i<a.size();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...