QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#468006#8658. A Question of IngestionBahnasy#WA 2ms20116kbC++20965b2024-07-08 18:42:102024-07-08 18:42:11

Judging History

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

  • [2024-07-08 18:42:11]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:20116kb
  • [2024-07-08 18:42:10]
  • 提交

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;

    double d = rem;
    d /= 3;
    d *= 2;
    int nw = d;
    //cout << rem << "\n";
    ret = solve(idx + 1, nw) + 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: 0ms
memory: 20116kb

input:

5 900
800 700 400 300 200

output:

2243

result:

ok single line: '2243'

Test #2:

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

input:

5 900
800 700 40 300 200

output:

1900

result:

ok single line: '1900'

Test #3:

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

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

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

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'