結果
| 問題 | No.1438 Broken Drawers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-19 17:28:55 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 411 ms / 2,000 ms |
| コード長 | 494 bytes |
| 記録 | |
| コンパイル時間 | 156 ms |
| コンパイル使用メモリ | 85,120 KB |
| 実行使用メモリ | 131,072 KB |
| 最終ジャッジ日時 | 2026-03-25 13:26:12 |
| 合計ジャッジ時間 | 7,196 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
ソースコード
N = int(input())
A = list(map(int,input().split()))
AA = []
for i in range(N):
AA.append((A[i], i))
AAS = sorted(AA)
l = [True]*N
count = 0
for i in range(1,N+1):
v = AAS[i-1][1]
if l[v] == False:
continue
flg = False
if v != 0:
if l[v-1]:
l[v-1] = False
count += 1
flg = True
else:
count += 1
flg = True
if flg and i > 1:
vv = AAS[i-2][1]
if v < vv:
l[vv] = False
print(count)