結果

問題 No.1687 What the Heck?
ユーザー mesame3993
提出日時 2021-09-24 22:13:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 385 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 81,768 KB
実行使用メモリ 86,564 KB
最終ジャッジ日時 2024-07-05 10:44:33
合計ジャッジ時間 4,095 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 WA * 3 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

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