結果
問題 | No.2770 Coupon Optimization |
ユーザー | atcoder8 |
提出日時 | 2024-05-31 22:53:34 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 266 ms / 3,000 ms |
コード長 | 742 bytes |
コンパイル時間 | 7,460 ms |
コンパイル使用メモリ | 312,836 KB |
実行使用メモリ | 24,516 KB |
最終ジャッジ日時 | 2024-12-21 00:59:55 |
合計ジャッジ時間 | 10,507 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 |
ソースコード
#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"; } }