結果

問題 No.1447 Greedy MtSaka
ユーザー lemonlemon
提出日時 2021-03-31 15:31:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 324 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 71,540 KB
最終ジャッジ日時 2023-08-21 12:52:24
合計ジャッジ時間 2,653 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,328 KB
testcase_01 AC 71 ms
71,444 KB
testcase_02 AC 71 ms
71,340 KB
testcase_03 AC 70 ms
71,228 KB
testcase_04 AC 73 ms
71,488 KB
testcase_05 AC 71 ms
71,040 KB
testcase_06 AC 70 ms
71,300 KB
testcase_07 AC 71 ms
71,540 KB
testcase_08 AC 71 ms
71,316 KB
testcase_09 AC 72 ms
71,432 KB
testcase_10 AC 72 ms
71,344 KB
testcase_11 AC 72 ms
71,332 KB
testcase_12 AC 71 ms
71,520 KB
testcase_13 AC 72 ms
71,332 KB
testcase_14 AC 71 ms
71,232 KB
testcase_15 AC 72 ms
71,392 KB
testcase_16 AC 70 ms
71,472 KB
testcase_17 AC 71 ms
71,392 KB
testcase_18 AC 71 ms
71,040 KB
testcase_19 AC 72 ms
71,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, itertools
 
sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
L = list()
S = 0

for i in range(n):
    L.append(na())

S += (L[n - 1][0] - L[1][0]) * L[0][1]
S += (L[n - 2][0] - L[0][0]) * L[n-1][1]

for i in range(1, (n- 1)):
    S += (L[i - 1][0] - L[i + 1][0]) * L[i][1]

print(S)
0