結果
問題 | No.2008 Super Worker |
ユーザー |
![]() |
提出日時 | 2022-07-15 21:28:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 147 ms / 2,000 ms |
コード長 | 629 bytes |
コンパイル時間 | 1,250 ms |
コンパイル使用メモリ | 128,548 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 16:54:36 |
合計ジャッジ時間 | 4,480 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>#include<cmath>#include<string>#include<iomanip>#include<numeric>#include<queue>#include<stack>#include<set>#include<map>using namespace std;typedef long long ll;const int mod=1e9+7;int dx[]={1,0,0,-1},dy[]={0,1,-1,0};struct st{ll a,b;};bool operator<(st a,st b){return a.a+b.a*a.b>b.a+a.a*b.b;}int main(){int n;static st ab[200000];cin>>n;for(int i=0;i<n;i++)cin>>ab[i].a;for(int i=0;i<n;i++)cin>>ab[i].b;sort(ab,ab+n);ll ans=0,tmp=1;for(int i=0;i<n;i++){ans=(ans+ab[i].a*tmp)%mod;tmp=tmp*ab[i].b%mod;}cout<<ans<<endl;}