QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#467996#8658. A Question of IngestionBahnasy#WA 4ms20024kbC++20912b2024-07-08 18:36:322024-07-08 18:36:33

Judging History

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

  • [2024-07-08 18:36:33]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:20024kb
  • [2024-07-08 18:36:32]
  • 提交

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;
#define int long long

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),solve(idx + 2, m) });
    //for (int i = idx + 3; 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: 2ms
memory: 20024kb

input:

5 900
800 700 400 300 200

output:

2243

result:

ok single line: '2243'

Test #2:

score: 0
Accepted
time: 4ms
memory: 19992kb

input:

5 900
800 700 40 300 200

output:

1900

result:

ok single line: '1900'

Test #3:

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

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

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: 3ms
memory: 19968kb

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'