結果
問題 | No.2008 Super Worker |
ユーザー |
![]() |
提出日時 | 2022-07-15 22:54:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 148 ms / 2,000 ms |
コード長 | 653 bytes |
コンパイル時間 | 2,646 ms |
コンパイル使用メモリ | 253,952 KB |
最終ジャッジ日時 | 2025-01-30 08:40:44 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/extc++.h>#include <atcoder/modint>int main(){using namespace std;using modint = atcoder::static_modint<1000000007>;unsigned long N;cin >> N;vector<pair<unsigned long, unsigned long>> jobs(N);for(auto&& [a, _] : jobs)cin >> a;for(auto&& [_, b] : jobs)cin >> b;sort(begin(jobs), end(jobs), [](auto&& i, auto&& j){auto&& [a0, b0]{i};auto&& [a1, b1]{j};return a0 + a1 * b0 > a1 + a0 * b1;});modint ans{}, now_level{1};for(const auto& [a, b] : jobs){ans += now_level * a;now_level *= b;}cout << ans.val() << endl;return 0;}