結果

問題 No.2770 Coupon Optimization
ユーザー hitonanodehitonanode
提出日時 2024-06-21 01:02:25
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 257 ms / 3,000 ms
コード長 549 bytes
コンパイル時間 2,997 ms
コンパイル使用メモリ 143,920 KB
実行使用メモリ 22,996 KB
最終ジャッジ日時 2024-06-21 01:02:34
合計ジャッジ時間 8,112 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/convolution>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
    vector<long long> A(N), B(M);
    for (auto &x : A) cin >> x, x /= 100;
    for (auto &x : B) cin >> x;
    sort(A.begin(), A.end());
    sort(B.rbegin(), B.rend());

    const auto C = atcoder::convolution_ll(A, B);
    long long ret = 0;
    for (int i = 0; i < N; ++i) {
        ret += A.at(i) * 100;
        cout << ret - C.at(i) << '\n';
    }
}
0