結果

問題 No.2008 Super Worker
ユーザー V_MelvilleV_Melville
提出日時 2022-07-16 00:12:47
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 5,750 ms
コンパイル使用メモリ 311,432 KB
実行使用メモリ 6,544 KB
最終ジャッジ日時 2023-09-10 06:34:08
合計ジャッジ時間 9,166 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 100 ms
6,368 KB
testcase_24 AC 100 ms
6,180 KB
testcase_25 AC 100 ms
6,216 KB
testcase_26 AC 100 ms
6,296 KB
testcase_27 AC 101 ms
6,500 KB
testcase_28 AC 138 ms
6,244 KB
testcase_29 AC 137 ms
6,300 KB
testcase_30 AC 138 ms
6,196 KB
testcase_31 AC 138 ms
6,360 KB
testcase_32 AC 139 ms
6,264 KB
testcase_33 AC 137 ms
6,544 KB
testcase_34 AC 139 ms
6,244 KB
testcase_35 AC 95 ms
6,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define fi first
#define se second

using std::cin;
using std::cout;
using std::vector;
using ll = long long;
using P = std::pair<ll, ll>;
using mint = modint1000000007;

int main() {
    int n;
    cin >> n;
    
    vector<P> p(n);
    rep(i, n) cin >> p[i].fi;
    rep(i, n) cin >> p[i].se;
    
    sort(p.begin(), p.end(), [&](P l, P r) {
        return r.fi*(l.se-1) > l.fi*(r.se-1);
    });
    
    mint ans, x = 1;
    for (auto [a, b] : p) {
        ans += x*a;
        x *= b;
    }
    
    cout << ans.val() << '\n';
    
    return 0;
}
0