Submission #605365

#TimeUsernameProblemLanguageResultExecution timeMemory
605365SamAnd비스킷 담기 (IOI20_biscuits)C++17
42 / 100
1049 ms15688 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;

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

    ll ans = 0;
    for (auto it = dp.begin(); it != dp.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:31:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   31 |     for (auto it = dp.begin(); it != dp.end(); ++it)
      |     ^~~
biscuits.cpp:33:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   33 |  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...