제출 #1043842

#제출 시각아이디문제언어결과실행 시간메모리
1043842aaaaaarroz비스킷 담기 (IOI20_biscuits)C++17
100 / 100
7 ms1376 KiB
    #include "biscuits.h"
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll count_tastiness(ll x, std::vector<ll> a) {
        ll ans=0;
        a.insert(a.begin(),0);
        while(a.size()<=60)
            a.push_back(0);
        vector<ll>dp(61),mx=a;
        for(int i=1;i<=60;i++)
            mx[i]+=mx[i-1]/2;
        dp[0]=1;
        for(int i=1;i<=60;i++) {
            if(mx[i]<x)
                dp[i]=dp[i-1];
            else {
                dp[i]=dp[i-1]+1;
                ll req=max(0ll,(x-a[i])<<1);
                for(int j=i;--j;){
                    if(mx[j]>=req+x){
                        dp[i]+=dp[j-1];
                        req=max(0ll,req-a[j]+x)<<1;
                    } else {
                        req=max(0ll,req-a[j])<<1;
                    }
                }
            }
        }
        return dp.back();
    }
     

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

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:6:12: warning: unused variable 'ans' [-Wunused-variable]
    6 |         ll ans=0;
      |            ^~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…