Submission #605364

#TimeUsernameProblemLanguageResultExecution timeMemory
605364SamAndPacking Biscuits (IOI20_biscuits)C++17
9 / 100
1080 ms9944 KiB
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define m_p make_pair
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int X = 20004, K = 202;

map<ll, ll> dp[K];
long long count_tastiness(long long x, std::vector<long long> a)
{
    for (int i = 0; i < 66; ++i)
        a.push_back(0);
    for (int i = 0; i <= sz(a); ++i)
        dp[i].clear();
    dp[0][0] = 1;
    for (int i = 0; i < sz(a); ++i)
    {
        for (auto it = dp[i].begin(); it != dp[i].end(); ++it)
        {
            int j = it->fi;
            dp[i + 1][(j + a[i]) / 2] += dp[i][j];
            if (j + a[i] - x >= 0)
                dp[i + 1][(j + a[i] - x) / 2] += dp[i][j];
        }
    }

    ll ans = 0;
    for (auto it = dp[sz(a)].begin(); it != dp[sz(a)].end(); ++it)
        ans += it->se;
	return ans;
}

Compilation message (stderr)

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:32:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   32 |     for (auto it = dp[sz(a)].begin(); it != dp[sz(a)].end(); ++it)
      |     ^~~
biscuits.cpp:34:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   34 |  return ans;
      |  ^~~~~~
#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...