제출 #333197

#제출 시각아이디문제언어결과실행 시간메모리
333197nickmet2004Packing Biscuits (IOI20_biscuits)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
#define ll long long
using namespace std;

ll dp[61] , Pr[61];

ll count_tastiness(ll X , vector<ll> a){
    int n = a.size();
    for(int i = 0; i < n; ++i) if(i)Pr[i] = Pr[i - 1] + a[i] * (1ll << i);
    dp[0] = 1;
    for(int k = 1; k < 61; ++k){
        ll S = min(Pr[i] , (1ll << k) - 1);
        for(int j = 60; ~i; --i){
            if(S >> j & 1) dp[i] += dp[j];
        }
        if(a[k -1])dp[i]++;
    }
    return dp[60];
}

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:12:23: error: 'i' was not declared in this scope
   12 |         ll S = min(Pr[i] , (1ll << k) - 1);
      |                       ^