Submission #773816

#TimeUsernameProblemLanguageResultExecution timeMemory
773816t6twotwoPacking Biscuits (IOI20_biscuits)C++17
42 / 100
1068 ms23952 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll count_tastiness(ll q, vector<ll> A) {
    A.resize(61);
    map<ll, ll> mp;
    mp[0] = 1;
    for (int i = 0; i < A.size(); i++) {
        map<ll, ll> t;
        for (auto [add, x] : mp) {
            t[(A[i] + add) / 2] += x;
            if (A[i] + add >= q) {
                t[(A[i] + add - q) / 2] += x;
            }
        }
        swap(mp, t);
    }
    ll ans = 0;
    for (auto [_, x] : mp) {
        ans += x;
    }
    return ans;   
}

Compilation message (stderr)

biscuits.cpp: In function 'll count_tastiness(ll, std::vector<long long int>)':
biscuits.cpp:9:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for (int i = 0; i < A.size(); i++) {
      |                     ~~^~~~~~~~~~
#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...