QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#617118 | #8281. Pangu and Stones | pengpeng_fudan# | WA | 0ms | 3784kb | C++23 | 1.1kb | 2024-10-06 13:58:17 | 2024-10-06 13:58:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define maxn 105
int a[maxn], op[maxn];
void solve(void) {
int n, L, R;
cin >> n >> L >> R;
for (int i = 1; i <= n; i++) cin >> a[i];
int64_t ans = INT64_MAX;
for (int len = 1; len * (L - 1) <= n - 1; len++) {
if (len * (R - 1) < n - 1) continue;
int rest = n - 1;
for (int i = 1; i <= len; i++) op[i] = L, rest -= L - 1;
for (int i = len; i; i--) op[i] += min(R - L, rest), rest -= min(R - L, rest);
priority_queue<int, vector<int>, greater<int>> que;
int64_t tot = 0;
for (int i = 1; i <= n; i++) que.push(a[i]);
for (int i = 1; i <= len; i++) {
int sum = 0;
while (op[i]--) sum += que.top(), que.pop();
tot += sum, que.push(sum);
}
ans = min(ans, tot);
}
cout << (ans == INT64_MAX ? 0 : ans) << endl;
return;
}
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int _ = 1;
while (_--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
3 2 2 1 2 3
output:
9
result:
ok 1 number(s): "9"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
3 2 3 1 2 3
output:
6
result:
ok 1 number(s): "6"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
4 3 3 1 2 3 4
output:
0
result:
ok 1 number(s): "0"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3592kb
input:
100 4 7 570 608 194 26 243 470 418 119 1000 936 440 302 797 155 676 283 869 60 959 793 158 397 808 656 379 316 485 854 753 280 543 435 756 822 106 561 402 347 99 739 8 682 834 549 812 32 338 765 699 575 575 785 171 504 335 113 284 612 276 518 835 677 865 900 687 48 859 179 343 318 626 812 523 11 400...
output:
116415
result:
wrong answer 1st numbers differ - expected: '120446', found: '116415'