結果
| 問題 |
No.2008 Super Worker
|
| コンテスト | |
| ユーザー |
yamake
|
| 提出日時 | 2022-07-15 21:31:06 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 149 ms / 2,000 ms |
| コード長 | 1,053 bytes |
| コンパイル時間 | 3,753 ms |
| コンパイル使用メモリ | 234,884 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 16:57:30 |
| 合計ジャッジ時間 | 6,905 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 33 |
コンパイルメッセージ
main.cpp: In function 'bool compare(std::array<long long int, 2>, std::array<long long int, 2>)':
main.cpp:21:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
21 | auto [a1,b1]=x;auto [a2,b2]=y;
| ^
main.cpp:21:25: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
21 | auto [a1,b1]=x;auto [a2,b2]=y;
| ^
main.cpp: In function 'int main()':
main.cpp:33:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
33 | auto [x,y]=a[i];
| ^
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define debug(output) if(debugFlag)cout<<#output<<"= "<<output<<"\n";
using lint = long long;
typedef pair<int,int> P;
const bool debugFlag=true;
const lint linf=1.1e18;const int inf=1.01e9;
constexpr int MOD=1000000007;
template<class T>bool chmax(T &a, const T &b) { if(a < b){ a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(a > b){ a = b; return 1; } return 0; }
#include<atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
bool compare(array<lint,2> x,array<lint,2> y){
auto [a1,b1]=x;auto [a2,b2]=y;
return a2*(b1-1)-a1*(b2-1)>0;
}
signed main(){
int n;cin>>n;
vector<array<lint,2>> a(n);
rep(j,2)rep(i,n)cin>>a[i][j];
sort(a.begin(),a.end(),compare);
mint res=0;
mint p=1;
rep(i,n){
auto [x,y]=a[i];
res+=p*x;
p*=y;
}
cout<<res.val()<<"\n";
return 0;
}
yamake