QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#467984 | #8658. A Question of Ingestion | Bahnasy# | WA | 2ms | 11816kb | C++20 | 863b | 2024-07-08 18:32:29 | 2024-07-08 18:32:29 |
Judging History
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'