結果
問題 | No.1687 What the Heck? |
ユーザー | Shirotsume |
提出日時 | 2021-09-25 02:18:26 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 365 bytes |
コンパイル時間 | 274 ms |
コンパイル使用メモリ | 87,144 KB |
実行使用メモリ | 108,924 KB |
最終ジャッジ日時 | 2023-09-18 22:46:15 |
合計ジャッジ時間 | 3,355 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 72 ms
71,248 KB |
testcase_01 | AC | 73 ms
71,192 KB |
testcase_02 | AC | 73 ms
71,312 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 91 ms
85,580 KB |
testcase_10 | AC | 87 ms
82,148 KB |
testcase_11 | AC | 87 ms
82,028 KB |
testcase_12 | AC | 122 ms
108,656 KB |
testcase_13 | AC | 119 ms
108,612 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
n = int(input()) p = list(map(int,input().split())) use = [True] * (n + 2) use[0] = False use[n + 1] = False ans = 0 usemin = 1 for i in range(n - 1, -1, -1): if use[p[i] + 1]: use[p[i] + 1] = False ans += i + 1 else: use[usemin] = False usemin += 1 if usemin < p[i]: ans -= i + 1 print(ans)