QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#467984#8658. A Question of IngestionBahnasy#WA 2ms11816kbC++20863b2024-07-08 18:32:292024-07-08 18:32:29

Judging History

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

  • [2024-07-08 18:32:29]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:11816kb
  • [2024-07-08 18:32:29]
  • 提交

answer

// #pragma GCC target("avx2,avx512f,avx512vl,avx512bw,avx512dq,avx512cd,avx512vbmi,avx512vbmi2,avx512vpopcntdq,avx512bitalg,bmi,bmi2,lzcnt,popcnt")
// #pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
using namespace std;

int dp[105][20005];
int n,m;
int arr[105];

int solve(int idx, int rem) {
    if (idx >= n)return 0;

    auto& ret = dp[idx][rem];
    if (ret != -1)return ret;

    //cout << rem << "\n";
    ret = solve(idx + 1, (2 * rem) / 3) + min(rem, arr[idx]);
    ret = max({ret,solve(idx + 1, rem) });
    for (int i = idx + 2; i < n; i++)ret = max(ret, solve(i, m));


    return ret;
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    memset(dp, -1, sizeof(dp));
    cin >> n >> m;

    for (int i = 0; i < n; i++)cin >> arr[i];

    cout << solve(0, m)<<"\n";
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 11764kb

input:

5 900
800 700 400 300 200

output:

2243

result:

ok single line: '2243'

Test #2:

score: 0
Accepted
time: 2ms
memory: 11784kb

input:

5 900
800 700 40 300 200

output:

1900

result:

ok single line: '1900'

Test #3:

score: 0
Accepted
time: 0ms
memory: 11816kb

input:

16 900
900 600 400 266 177 118 78 52 34 22 14 9 6 4 2 1

output:

2683

result:

ok single line: '2683'

Test #4:

score: 0
Accepted
time: 0ms
memory: 11764kb

input:

33 900
900 600 400 266 177 118 78 52 34 22 14 9 6 4 2 1 1 900 600 400 266 177 118 78 52 34 22 14 9 6 4 2 1

output:

5365

result:

ok single line: '5365'

Test #5:

score: -100
Wrong Answer
time: 2ms
memory: 11764kb

input:

100 2000
2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2...

output:

85977

result:

wrong answer 1st lines differ - expected: '101333', found: '85977'