結果
問題 | No.2008 Super Worker |
ユーザー |
![]() |
提出日時 | 2022-08-02 22:08:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 162 ms / 2,000 ms |
コード長 | 660 bytes |
コンパイル時間 | 2,016 ms |
コンパイル使用メモリ | 175,284 KB |
実行使用メモリ | 12,720 KB |
最終ジャッジ日時 | 2024-07-23 16:09:42 |
合計ジャッジ時間 | 6,549 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 33 |
ソースコード
#include <bits/stdc++.h>using namespace std;const long long mod = 1000000007;int main() {int n;cin >> n;vector<long long> a(n), b(n);for (int i = 0; i < n; i++) {cin >> a[i];}for (int i = 0; i < n; i++) {cin >> b[i];}vector<pair<long double, int>> p(n);for (int i = 0; i < n; i++) {p[i] = make_pair(((long double)(b[i] - 1) / a[i]), i);}sort(p.begin(), p.end());reverse(p.begin(), p.end());long long ans = 0;long long x = 1;for (int i = 0; i < n; i++) {int j = p[i].second;ans += x % mod * a[j] % mod;ans %= mod;x *= b[j];x %= mod;}cout << ans << endl;return 0;}