結果
問題 |
No.1687 What the Heck?
|
ユーザー |
![]() |
提出日時 | 2021-09-24 21:51:14 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 392 bytes |
コンパイル時間 | 146 ms |
コンパイル使用メモリ | 82,388 KB |
実行使用メモリ | 87,160 KB |
最終ジャッジ日時 | 2024-07-05 10:26:31 |
合計ジャッジ時間 | 3,964 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 2 WA * 3 TLE * 1 -- * 12 |
ソースコード
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[0] == p[-1]: takeda = takeda[1:] continue takeda = takeda[1:] ansS += score print(ansT - ansS)