제출 #837093

#제출 시각아이디문제언어결과실행 시간메모리
837093azatega비스킷 담기 (IOI20_biscuits)C++17
0 / 100
1 ms340 KiB
#include <map>
#include <vector>

using namespace std;

#define ll long long

map<pair<int, ll>, ll> memo;
vector<ll> a;
ll x;

ll compute(int k, ll amount){
    if(memo.count({k, amount}) > 0)
        return memo[{k, amount}];

    if(k == a.size() - 1){
        // last one
        ll res = 1;
        if(amount >= x)
            res++;
        memo[{k, amount}] = res;
        return res;
    }

    ll res = 0;
    if(amount >= x)
        res += compute(k+1, a[k+1] + (amount - x)/2);
    res += compute(k+1, a[k+1] + amount/2);
    memo[{k, amount}] = res;
    return res;
}

long long count_tastiness(long long _x, vector<long long> _a){
    memo.clear();

    a = _a;
    x = _x;

    return compute(0, a[0]);
}

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

biscuits.cpp: In function 'long long int compute(int, long long int)':
biscuits.cpp:16:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     if(k == a.size() - 1){
      |        ~~^~~~~~~~~~~~~~~
#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...