結果

問題 No.2008 Super Worker
ユーザー Nzt3Nzt3
提出日時 2022-07-15 22:39:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 65 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 205,272 KB
実行使用メモリ 6,436 KB
最終ジャッジ日時 2023-09-10 03:35:57
合計ジャッジ時間 5,148 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 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,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 56 ms
6,128 KB
testcase_24 AC 55 ms
6,160 KB
testcase_25 AC 54 ms
6,140 KB
testcase_26 AC 54 ms
6,188 KB
testcase_27 AC 55 ms
6,376 KB
testcase_28 AC 63 ms
6,088 KB
testcase_29 AC 64 ms
6,164 KB
testcase_30 AC 63 ms
6,228 KB
testcase_31 AC 64 ms
6,116 KB
testcase_32 AC 65 ms
6,208 KB
testcase_33 AC 50 ms
6,148 KB
testcase_34 AC 63 ms
6,144 KB
testcase_35 AC 41 ms
6,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<array<long long,2>>A(N);
  for(auto &i:A)cin>>i[0];
  for(auto &i:A)cin>>i[1];
  sort(A.begin(),A.end(),[](array<long long,2>a,array<long long,2>b){
    return a[0]+a[1]*b[0]>b[0]+b[1]*a[0];
  });
  long long ans=0,x=1;
  for(int i=0;i<N;i++){
    ans=(ans+x*A[i][0])%mod;
    x=x*A[i][1]%mod;
  }
  cout<<ans<<'\n';
}
0