結果

問題 No.2008 Super Worker
ユーザー StstoneStstone
提出日時 2022-07-21 17:29:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 1,051 bytes
コンパイル時間 3,168 ms
コンパイル使用メモリ 228,964 KB
実行使用メモリ 10,584 KB
最終ジャッジ日時 2023-09-15 22:37:01
合計ジャッジ時間 6,839 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,376 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,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 62 ms
9,528 KB
testcase_24 AC 63 ms
9,568 KB
testcase_25 AC 63 ms
9,256 KB
testcase_26 AC 63 ms
10,584 KB
testcase_27 AC 63 ms
10,024 KB
testcase_28 AC 71 ms
9,752 KB
testcase_29 AC 72 ms
9,444 KB
testcase_30 AC 72 ms
10,544 KB
testcase_31 AC 71 ms
10,076 KB
testcase_32 AC 72 ms
9,568 KB
testcase_33 AC 57 ms
9,372 KB
testcase_34 AC 72 ms
9,476 KB
testcase_35 AC 48 ms
9,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#pragma GCC optimize(2)
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define de_bug(x) cout << (x) << '\n'
#define loli(x) cout << (x) << ' '
#define yn(x) cout << (x==1?"Yes\n":"No\n")
#define PI 3.14159265358979323
#define Ststone ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const ll max_n=2e5+10,mod=1e9+7;
ll t,k,n,m,h,q,a,b;
vector<pii> v;
vector<ll> v2;
str s;
char c;

bool cmp(pii A,pii B){
    return A.F+A.S*B.F>B.F+B.S*A.F;
}
int main(){
    Ststone;
    cin >> n;
    ll ans = 0,cnt = 0;
    for(ll i=0;i<n;i++){
        cin >> a;
        v2.pb(a);
    }
    for(ll i=0;i<n;i++){
        cin >> a;
        v.pb({v2[i],a});
    }
    sort(all(v),cmp);
    ll lv = 1;
    for(ll i=0;i<n;i++){
        ans = (ans + ((lv*(v[i].F))%mod))%mod;
        lv = (lv*(v[i].S))%mod;
    }
    cout << ans%mod << '\n';
}
/*
*/
0