QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#467959#8658. A Question of IngestionBahnasy#WA 2ms11912kbC++20820b2024-07-08 18:27:222024-07-08 18:27:23

Judging History

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

  • [2024-07-08 18:27:23]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:11912kb
  • [2024-07-08 18:27:22]
  • 提交

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, rem);
    ret = max({ret, solve(idx + 2, m), solve(idx + 1, 2 * rem / 3) + min(rem, arr[idx]) });
    


    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";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 11836kb

input:

5 900
800 700 400 300 200

output:

2243

result:

ok single line: '2243'

Test #2:

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

input:

5 900
800 700 40 300 200

output:

1900

result:

ok single line: '1900'

Test #3:

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

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: 11912kb

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: 11784kb

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'