結果

問題 No.2008 Super Worker
ユーザー HIcoderHIcoder
提出日時 2023-07-13 18:55:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 1,061 bytes
コンパイル時間 1,043 ms
コンパイル使用メモリ 112,844 KB
実行使用メモリ 6,392 KB
最終ジャッジ日時 2023-10-13 07:52:48
合計ジャッジ時間 6,756 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 1 ms
4,352 KB
testcase_11 AC 1 ms
4,356 KB
testcase_12 AC 1 ms
4,352 KB
testcase_13 AC 2 ms
4,352 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 1 ms
4,352 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 2 ms
4,352 KB
testcase_20 AC 2 ms
4,352 KB
testcase_21 AC 2 ms
4,352 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 93 ms
6,104 KB
testcase_24 AC 92 ms
6,176 KB
testcase_25 AC 91 ms
6,328 KB
testcase_26 AC 92 ms
6,320 KB
testcase_27 AC 94 ms
6,100 KB
testcase_28 AC 126 ms
6,160 KB
testcase_29 AC 131 ms
6,124 KB
testcase_30 AC 129 ms
6,148 KB
testcase_31 AC 128 ms
6,192 KB
testcase_32 AC 127 ms
6,112 KB
testcase_33 AC 125 ms
6,264 KB
testcase_34 AC 136 ms
6,232 KB
testcase_35 AC 87 ms
6,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<set> 
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
#include <unordered_set>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<ll,ll> P;
typedef pair<int,P> PP;
const ll MOD=1e9+7;


int main(){
    int N;
    cin>>N;
    vector<P> AB(N);
    for(int i=0;i<N;i++){
        cin>>AB[i].first;
    }

    for(int i=0;i<N;i++){
        cin>>AB[i].second;
    }

    sort(AB.begin(),AB.end(),
    [](const P& lhs,const P& rhs){
        /*
        if(lhs.first!=rhs.first){
            return lhs.first<rhs.first;//Aが小さいほう
        }else{
            return lhs.second>rhs.second;//Bが大きいほう
        }
        */
        return rhs.first*(lhs.second-1)>lhs.first*(rhs.second-1);
    });

    ll ans=0;

    ll now=1;//今のバイトレベル
    
    for(int i=0;i<N;i++){
        auto [a,b]=AB[i];
        ans+=now*a%MOD;//給料
        ans%=MOD;

        now=b*now%MOD;
    }

    cout<<ans<<endl;

}
0