結果

問題 No.1687 What the Heck?
ユーザー mesame3993mesame3993
提出日時 2021-09-24 22:13:21
言語 PyPy3
(7.3.13)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 1,098 ms
コンパイル使用メモリ 86,448 KB
実行使用メモリ 71,304 KB
最終ジャッジ日時 2023-09-18 21:31:40
合計ジャッジ時間 4,822 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,228 KB
testcase_01 AC 75 ms
71,212 KB
testcase_02 AC 75 ms
71,044 KB
testcase_03 WA -
testcase_04 AC 75 ms
71,044 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
	for j in range(len(takeda)):
		if takeda[j] > p[i]:
			ansT += score
			takeda.remove(takeda[j])
			break
	else:
		if takeda == p:
			takeda = takeda[1:]
			continue
		takeda = takeda[1:]
		ansS += score
print(ansT - ansS)
0