제출 #309702

#제출 시각아이디문제언어결과실행 시간메모리
309702georgerapeanu비스킷 담기 (IOI20_biscuits)C++17
42 / 100
1089 ms16152 KiB
#include "biscuits.h"
#include <vector>
#include <algorithm>
#include <unordered_map>

using namespace std;


long long count_tastiness(long long x, vector<long long> a) {

    unordered_map<long long,long long> mp;

    mp[0] = 1;

    for(int i = 0;i < (int)a.size() || mp.begin()->first != 0 || (int)mp.size() > 1;i++){
        unordered_map<long long,long long> tmp;
        for(auto it2:mp){
            pair<long long,long long> it = it2;
            if(i < (int)a.size()){
                it.first += a[i];
            }
            tmp[it.first / 2] += it.second;
            if(it.first >= x){
                tmp[(it.first - x) / 2] += it.second;
            }
        }
        mp = tmp;
    }

	return mp[0];
}

#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...