結果

問題 No.2008 Super Worker
ユーザー KoseTKoseT
提出日時 2022-07-15 23:12:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,303 bytes
コンパイル時間 1,064 ms
コンパイル使用メモリ 103,152 KB
実行使用メモリ 6,368 KB
最終ジャッジ日時 2023-09-10 04:51:05
合計ジャッジ時間 4,342 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 52 ms
6,156 KB
testcase_24 AC 52 ms
6,368 KB
testcase_25 AC 52 ms
6,096 KB
testcase_26 AC 53 ms
6,100 KB
testcase_27 AC 53 ms
6,160 KB
testcase_28 AC 61 ms
6,084 KB
testcase_29 AC 62 ms
6,144 KB
testcase_30 AC 62 ms
6,164 KB
testcase_31 AC 61 ms
6,188 KB
testcase_32 AC 61 ms
6,228 KB
testcase_33 AC 49 ms
6,196 KB
testcase_34 AC 62 ms
6,144 KB
testcase_35 AC 39 ms
6,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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';
}
0