結果

問題 No.2770 Coupon Optimization
ユーザー atcoder8atcoder8
提出日時 2024-05-31 22:53:34
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 253 ms / 3,000 ms
コード長 742 bytes
コンパイル時間 5,681 ms
コンパイル使用メモリ 313,792 KB
実行使用メモリ 24,644 KB
最終ジャッジ日時 2024-05-31 22:54:27
合計ジャッジ時間 10,288 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 59 ms
12,780 KB
testcase_04 AC 233 ms
24,520 KB
testcase_05 AC 29 ms
11,212 KB
testcase_06 AC 227 ms
24,524 KB
testcase_07 AC 229 ms
24,512 KB
testcase_08 AC 246 ms
24,504 KB
testcase_09 AC 105 ms
11,848 KB
testcase_10 AC 118 ms
12,208 KB
testcase_11 AC 60 ms
7,324 KB
testcase_12 AC 209 ms
16,944 KB
testcase_13 AC 123 ms
13,516 KB
testcase_14 AC 249 ms
24,644 KB
testcase_15 AC 248 ms
24,388 KB
testcase_16 AC 248 ms
24,392 KB
testcase_17 AC 253 ms
24,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);

    ll n, m;
    cin >> n >> m;
    vector<ll> aa(n);
    for (int i = 0; i < n; i++) cin >> aa[i];
    sort(aa.begin(), aa.end());
    vector<ll> bb(m);
    for (int i = 0; i < m; i++) cin >> bb[i];
    sort(bb.begin(), bb.end(), greater<ll>());

    vector<ll> prefix_sum(n + 1);
    for (ll i = 0; i < n; i++) {
        prefix_sum[i + 1] = prefix_sum[i] + aa[i];
    }

    auto conv = convolution_ll(aa, bb);
    for (ll i = 1; i <= n; i++) {
        cout << (prefix_sum[i] - conv[i - 1] / 100) << "\n";
    }
}
0