QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#637277#7304. Coins 2heigeWA 0ms3644kbC++14840b2024-10-13 11:57:412024-10-13 11:57:42

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 11:57:42]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3644kb
  • [2024-10-13 11:57:41]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn = 105;
int n, sum, cnt, x, y;
int a[maxn];
int dp[100005];
signed main() {
    // freopen("c.in", "r", stdin);
    // freopen("c.out", "w", stdout);
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> a[i]; sum += a[i] * i;
        if (a[i]) x = y, y = i;
    }
    int hg = max((x == 0 ? y * y : x * y), sum);
    dp[0] = 1;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= min(2 * hg / i, a[i]); j++)
            for (int k = 2 * hg; k >= i; k--)
                dp[k] |= dp[k - i];
    for (int i = 1; i <= hg; i++) cnt += dp[i];
    cnt *= sum / hg;
    for (int i = 1; i <= sum % hg; i++) cnt += dp[i];
    cout << cnt + 1 << '\n';
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3644kb

input:

3
0 1 2
3
0 2 3

output:

6

result:

wrong answer Answer contains longer sequence [length = 2], but output contains 1 elements