結果

問題 No.2008 Super Worker
ユーザー Nzt3Nzt3
提出日時 2022-07-15 22:39:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 1,937 ms
コンパイル使用メモリ 198,596 KB
最終ジャッジ日時 2025-01-30 08:27:33
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

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