提出 #75875502
ソースコード 拡げる
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using ll = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
vector<ll> A(N), B(N), C(N);
for (int i = 0; i < N; ++i) {
cin >> A[i] >> B[i] >> C[i];
}
priority_queue<ll> pq;
ll cur = 0, sum = 0;
for (int i = 0; i < N; ++i) {
sum += A[i];
pq.push(C[i]);
while (cur + 1 <= 1e18 && sum >= (cur + 1) * B[i]) {
++cur;
sum -= B[i];
}
while (sum < cur * B[i] && !pq.empty()) {
ll c = pq.top();
pq.pop();
sum += c;
--cur;
}
if (sum < cur * B[i]) break;
}
cout << cur + (sum >= cur * B.back() ? 0 : 0);
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | G - Children Yearn for the Evil Kindergarten |
| ユーザ | zkl018 |
| 言語 | C++23 (GCC 15.2.0) |
| 得点 | 0 |
| コード長 | 989 Byte |
| 結果 | WA |
| 実行時間 | > 2000 ms |
| メモリ | 10444 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||||
|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 0 / 625 | ||||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00-sample-01.txt |
| All | 00-sample-01.txt, 01-big-01.txt, 01-big-02.txt, 01-big-03.txt, 01-big-04.txt, 01-big-05.txt, 01-big-06.txt, 02-allone-01.txt, 03-random-01.txt, 03-random-02.txt, 03-random-03.txt, 03-random-04.txt, 03-random-05.txt, 03-random-06.txt, 04-randommed-01.txt, 04-randommed-02.txt, 04-randommed-03.txt, 04-randommed-04.txt, 04-randommed-05.txt, 04-randommed-06.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00-sample-01.txt | WA | 1 ms | 3584 KiB |
| 01-big-01.txt | TLE | > 2000 ms | 10444 KiB |
| 01-big-02.txt | TLE | > 2000 ms | 10392 KiB |
| 01-big-03.txt | TLE | > 2000 ms | 6816 KiB |
| 01-big-04.txt | TLE | > 2000 ms | 5832 KiB |
| 01-big-05.txt | TLE | > 2000 ms | 4032 KiB |
| 01-big-06.txt | TLE | > 2000 ms | 4132 KiB |
| 02-allone-01.txt | TLE | > 2000 ms | 3364 KiB |
| 03-random-01.txt | WA | 159 ms | 3588 KiB |
| 03-random-02.txt | WA | 37 ms | 10316 KiB |
| 03-random-03.txt | WA | 35 ms | 3936 KiB |
| 03-random-04.txt | WA | 37 ms | 3600 KiB |
| 03-random-05.txt | WA | 64 ms | 3396 KiB |
| 03-random-06.txt | WA | 548 ms | 3556 KiB |
| 04-randommed-01.txt | TLE | > 2000 ms | 3152 KiB |
| 04-randommed-02.txt | WA | 184 ms | 3684 KiB |
| 04-randommed-03.txt | WA | 39 ms | 4536 KiB |
| 04-randommed-04.txt | TLE | > 2000 ms | 3256 KiB |
| 04-randommed-05.txt | WA | 253 ms | 3524 KiB |
| 04-randommed-06.txt | WA | 34 ms | 4848 KiB |