結果

問題 No.2284 Assembly
ユーザー 河城白露河城白露
提出日時 2023-04-29 20:47:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 545 bytes
コンパイル時間 699 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 6,784 KB
最終ジャッジ日時 2024-04-29 10:59:25
合計ジャッジ時間 2,308 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 39 ms
6,784 KB
testcase_09 AC 39 ms
6,784 KB
testcase_10 AC 39 ms
6,656 KB
testcase_11 AC 39 ms
6,656 KB
testcase_12 AC 39 ms
6,656 KB
testcase_13 AC 39 ms
6,784 KB
testcase_14 AC 39 ms
6,784 KB
testcase_15 AC 39 ms
6,656 KB
testcase_16 AC 38 ms
6,784 KB
testcase_17 AC 39 ms
6,784 KB
testcase_18 AC 41 ms
6,784 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#define ll long long
#define db double
using namespace std;
const ll N = 2e5 + 100;
ll sma,smb,ans,n;
ll a[N],b[N];
int main() {
	scanf("%lld",&n);
	for (ll i = 1;i <= n;i++) {
		scanf("%lld%lld",&a[i],&b[i]);
	}
	sma = smb = ans = 0;
	for (ll i = n;i > 0;i--) {
		ans += max(a[i] * smb,b[i] * sma);
		sma += a[i];
		smb += b[i];
	}
	printf("%lld",ans);
	return 0;
}
0