結果
| 問題 |
No.2284 Assembly
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-04-28 21:56:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 8 ms / 2,000 ms |
| コード長 | 2,365 bytes |
| コンパイル時間 | 1,599 ms |
| コンパイル使用メモリ | 167,888 KB |
| 実行使用メモリ | 11,852 KB |
| 最終ジャッジ日時 | 2024-11-17 20:54:48 |
| 合計ジャッジ時間 | 2,210 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
/*
* Author: $%U%$
* Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=200003,M=3003,K=503,MOD=998244353,INF=9000000000000000007ll;
#define rep(i,a,b) for(ll i=(a);i<=(b);i++)
#define per(i,a,b) for(ll i=(a);i>=(b);i--)
#define re(i,a,b) for(ll i=(a);i<(b);i++)
#define pe(i,a,b) for(ll i=(a);i>(b);i--)
ll gcd(ll A,ll B){return B?gcd(B,A%B):A;}
ll pw(ll A,ll B){
ll res=1;
while(B){
if(B&1)res=res*A%MOD;
A=A*A%MOD;
B>>=1;
}
return res;
}
#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
char buf[1<<21],*p1=buf,*p2=buf;
template <typename T>
inline void read(T& r) {
r=0;bool w=0; char ch=getchar();
while(ch<'0'||ch>'9') w=ch=='-'?1:0,ch=getchar();
while(ch>='0'&&ch<='9') r=r*10+(ch^48), ch=getchar();
r=w?-r:r;
}
template <typename T>
inline void readupp(T& r){
r=0;
char ch=getchar();
while(ch>'Z'||ch<'A')ch=getchar();
r=ch;
}
template <typename T>
inline void readlow(T& r){
r=0;
char ch=getchar();
while(ch>'z'||ch<'a')ch=getchar();
r=ch;
}
template <typename T>
inline void readdig(T& r){
r=0;
char ch=getchar();
while(ch>'9'||ch<'0')ch=getchar();
r=ch-'0';
}
template <typename T>
inline void readvisi(T& r){
r=0;
char ch=getchar();
while(ch>126||ch<33)ch=getchar();
r=ch;
}
template <typename T>
inline ll readlowstr(T& r){
ll n=0;
char ch=getchar();
while(ch>'z'||ch<'a')ch=getchar();
while(ch<='z'&&ch>='a')r[++n]=ch,ch=getchar();
return n;
}
template <typename T>
inline ll readuppstr(T& r){
ll n=0;
char ch=getchar();
while(ch>'Z'||ch<'A')ch=getchar();
while(ch<='Z'&&ch>='A')r[++n]=ch,ch=getchar();
return n;
}
template <typename T>
inline ll readdigstr(T& r){
ll n=0;
char ch=getchar();
while(ch>'9'||ch<'0')ch=getchar();
while(ch<='9'&&ch>='0')r[++n]=ch,ch=getchar();
return n;
}
template <typename T>
inline ll readvisistr(T& r){
ll n=0;
char ch=getchar();
while(ch>126||ch<33)ch=getchar();
while(ch<=126&&ch>=33)r[++n]=ch,ch=getchar();
return n;
}
void _FILE(string s){
freopen((s+".in").c_str(),"r",stdin);
freopen((s+".out").c_str(),"w",stdout);
}
ll n,a[N],b[N],c[N],d[N];
int main(){
read(n);
rep(i,1,n)read(a[i]),read(b[i]);
per(i,n,1)c[i]=c[i+1]+a[i];
per(i,n,1)d[i]=d[i+1]+b[i];
ll ans=0;
rep(i,1,n)ans+=max(a[i]*d[i+1],b[i]*c[i+1]);
printf("%lld",ans);
return 0;
}