結果
| 問題 | No.1687 What the Heck? |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-09-25 02:18:26 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 365 bytes |
| 記録 | |
| コンパイル時間 | 262 ms |
| コンパイル使用メモリ | 84,992 KB |
| 実行使用メモリ | 104,832 KB |
| 最終ジャッジ日時 | 2026-03-26 19:20:50 |
| 合計ジャッジ時間 | 2,478 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 12 |
ソースコード
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)