답안 #590321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590321 2022-07-05T20:27:09 Z ogibogi2004 비스킷 담기 (IOI20_biscuits) C++14
컴파일 오류
0 ms 0 KB
#include "biscuits.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
unordered_map<ll,ll>dp;
ll s[64];
ll calc(ll n)
{
    if(dp.count(n))return dp[n];
    int t=0,pw2=1;
    while(pw2<n){pw2*=2;t++;}
    pw2/=2;t--;
    return dp[n]=calc(pw2)+calc(min(n,1+s[i]/x)-pw2);
}
long long count_tastiness(long long x, vector<long long> a) {
    dp.clear();
    s[0]=a[0];
    for(int i=1;i<a.size();i++)
    {
        s[i]=s[i-1]+a[i];
    }
    for(int i=0;i<=a.size();i++)
    {
        calc((1ll<<i));
    }
    return dp[(1ll<<a.size())];
}

Compilation message

biscuits.cpp: In function 'long long int calc(long long int)':
biscuits.cpp:13:43: error: 'i' was not declared in this scope
   13 |     return dp[n]=calc(pw2)+calc(min(n,1+s[i]/x)-pw2);
      |                                           ^
biscuits.cpp:13:46: error: 'x' was not declared in this scope
   13 |     return dp[n]=calc(pw2)+calc(min(n,1+s[i]/x)-pw2);
      |                                              ^
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |     for(int i=1;i<a.size();i++)
      |                 ~^~~~~~~~~
biscuits.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0;i<=a.size();i++)
      |                 ~^~~~~~~~~~