結果
| 問題 |
No.2008 Super Worker
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-07-15 23:12:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 84 ms / 2,000 ms |
| コード長 | 1,303 bytes |
| コンパイル時間 | 1,160 ms |
| コンパイル使用メモリ | 100,828 KB |
| 最終ジャッジ日時 | 2025-01-30 08:54:53 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
ソースコード
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
template<typename T>
void maxs(T& x, T&& y) {
x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
x=std::max(x,y);
}
template<typename T>
void mins(T& x, T&& y) {
x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
x=std::min(x,y);
}
struct DataType {
ll a,b;
};
bool operator<(const DataType& l, const DataType& r) {
return r.b*l.a + r.a < l.b*r.a + l.a;
}
int main() {
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
cin >> n;
vector<DataType> a(n);
rep(i,n) cin >> a[i].a;
rep(i,n) cin >> a[i].b;
sort(a.begin(), a.end());
ll mod {1000000000+7};
ll lv {1};
ll reward {};
rep(i,n) {
reward += lv*a[i].a;
lv *= a[i].b;
lv %= mod;
reward %= mod;
}
cout << reward << '\n';
}