結果
| 問題 | No.2008 Super Worker |
| コンテスト | |
| ユーザー |
ぷら
|
| 提出日時 | 2022-07-15 22:49:24 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 99 ms / 2,000 ms |
| コード長 | 721 bytes |
| 記録 | |
| コンパイル時間 | 1,434 ms |
| コンパイル使用メモリ | 218,508 KB |
| 実行使用メモリ | 6,656 KB |
| 最終ジャッジ日時 | 2026-06-26 16:12:51 |
| 合計ジャッジ時間 | 5,243 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}
ぷら