結果
| 問題 | 
                            No.2008 Super Worker
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-07-15 21:36:20 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 563 bytes | 
| コンパイル時間 | 2,075 ms | 
| コンパイル使用メモリ | 200,120 KB | 
| 最終ジャッジ日時 | 2025-01-30 07:33:11 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 22 WA * 11 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int main () {
    int N;
    cin >> N;
    vector<P> A(N);
    for (auto& [a, b] : A) {
        cin >> a;
    }
    for (auto& [a, b] : A) {
        cin >> b;
    }
    sort(A.begin(), A.end(), [](P a, P b) {return a.first + a.second * b.first > b.first + b.second * a.first;});
    ll ans = 0;
    ll m = 1e9 + 7;
    ll now = 1;
    for (auto [a, b] : A) {
        ans += a * now;
        ans %= m;
        now *= b;
        now %= m;
    }
    cout << ans << endl;
}