結果
問題 | No.2008 Super Worker |
ユーザー |
![]() |
提出日時 | 2022-07-15 22:49:24 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 163 ms / 2,000 ms |
コード長 | 721 bytes |
コンパイル時間 | 2,317 ms |
コンパイル使用メモリ | 201,668 KB |
最終ジャッジ日時 | 2025-01-30 08:38:30 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;constexpr int mod = 1000000007;bool flag(pair<int,int>a,pair<int,int>b) {if(1ll*b.second*a.first+b.first < 1ll*a.second*b.first+a.first) {return true;}return false;}int main() {int N;cin >> N;vector<int>A(N),B(N);vector<pair<int,int>>tmp(N);for(int i = 0; i < N; i++) {cin >> A[i];}for(int i = 0; i < N; i++) {cin >> B[i];tmp[i] = {A[i],B[i]};}sort(tmp.begin(),tmp.end(),flag);long long ans = 0,x = 1;for(int i = 0; i < N; i++) {ans += x*tmp[i].first%mod;ans %= mod;x *= tmp[i].second;x %= mod;}cout << ans << endl;}