제출 #444059

#제출 시각아이디문제언어결과실행 시간메모리
444059fivefourthreeone비스킷 담기 (IOI20_biscuits)C++17
컴파일 에러
0 ms0 KiB
#pragma GCC target ("avx2")
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
#define owo(i,a, b) for(int i=(a);i<(b); ++i)
#define uwu(i,a, b) for(int i=(a)-1; i>=(b); --i)
#define senpai push_back
#define ttgl pair<int, int>
#define ayaya cout<<"ayaya~"<<endl
 
using namespace std;
using ll = long long;
using ld = long double;
const ll MOD = 1000000007;
const ll root = 3;
ll binpow(ll a,ll b){ll res=1;while(b){if(b&1)res=(res*a)%MOD;a=(a*a)%MOD;b>>=1;}return res;}
ll modInv(ll a){return binpow(a, MOD-2);}
const int INF = 0x3f3f3f3f;
const int NINF = 0xc0c0c0c0;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll NINFLL = 0xc0c0c0c0c0c0c0c0;
const int mxN = 11;
ll arr[mxN];
ll dp[mxN];
ll x;
ll sumgo(int bit) {
    ll ret = 1;
    owo(i, 0, bit+1) {
        ret += dp[i]; 
    }
    return ret;
}
ll go(int bit, ll loss) {
    //take this bit
    ll ret = 0;
    if(arr[bit] - loss >= x) {
        //no loss
        ret += sumgo(bit-1);
    }else {
        ll req = (x - arr[bit]) << 1LL;
        uwu(i, bit, 0) {
            if(arr[i] >= req) {
                ret += go(i, req) + sumgo(i-1);
                break;
            }else {
                req = (req - arr[i]) << 1LL;
            }
        }
    }
    return ret;
}
ll count_tastiness(ll k, vector<ll> f) {
    x = k;
    int n = f.size();
    ll res = 0;
    memset(arr, 0, sizeof(arr));
    memset(dp, 0, sizeof(dp));
    owo(i, 0, mxN) {
        if(i < n)arr[i] += f[i];
        if(arr[i] > x) {
            arr[i+1] = (arr[i] - x) / 2LL;
            arr[i] -= arr[i+1]*2LL;
        }
        //cout<<i<<" "<<arr[i]<<"\n";
    }
    owo(i, 0, mxN) {
        dp[i] = go(i, 0);
        //cout<<i<<" "<<dp[i]<<" dp...\n";
        res += dp[i];
    }
    return res+1;
}
int main() {
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    cin.tie(0)->sync_with_stdio(0);
    int T = 1;
    //cin>>T;
    int N, K;
    vector<int> A;
    cin>>N>>K;
    A.resize(N);
    owo(i, 0, N) {
        cin>>A[i];
    }
    cout<<count_tastiness(K, A);
    /*for(int tc = 1; tc <= T; tc++) {
        solve();
    }*/
    return 0;
}

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

biscuits.cpp: In function 'int main()':
biscuits.cpp:87:30: error: could not convert 'A' from 'vector<int>' to 'vector<long long int>'
   87 |     cout<<count_tastiness(K, A);
      |                              ^
      |                              |
      |                              vector<int>
biscuits.cpp:78:9: warning: unused variable 'T' [-Wunused-variable]
   78 |     int T = 1;
      |         ^