結果

問題 No.1687 What the Heck?
ユーザー mesame3993mesame3993
提出日時 2021-09-24 22:34:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,200 KB
実行使用メモリ 91,732 KB
最終ジャッジ日時 2023-09-18 21:48:34
合計ジャッジ時間 4,705 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,904 KB
testcase_01 AC 73 ms
71,352 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 72 ms
71,404 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
p = list(map(int, input().split()))
p = list(reversed(p))
takeda = [x for x in range(1, n+1)]
ansT, ansS = 0, 0

for i in range(n):
	score = n-i
	tmp = p[i]
	while True:
		tmp += 1
		if tmp in takeda:
			ansT += score
			takeda.remove(tmp)
			break
		if tmp > max(takeda):
			if p[i] in takeda:
				takeda = takeda[1:]
			else:
				ansS += score
				takeda = takeda[1:]
			break
print(ansT - ansS)
0