結果
問題 | No.2008 Super Worker |
ユーザー |
|
提出日時 | 2023-07-13 18:55:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 161 ms / 2,000 ms |
コード長 | 1,061 bytes |
コンパイル時間 | 1,194 ms |
コンパイル使用メモリ | 110,140 KB |
最終ジャッジ日時 | 2025-02-15 10:14:38 |
ジャッジサーバーID (参考情報) |
judge4 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#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; }