結果
問題 | No.1438 Broken Drawers |
ユーザー |
|
提出日時 | 2021-04-19 17:28:55 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 583 ms / 2,000 ms |
コード長 | 494 bytes |
コンパイル時間 | 182 ms |
コンパイル使用メモリ | 82,320 KB |
実行使用メモリ | 114,528 KB |
最終ジャッジ日時 | 2024-07-04 05:00:40 |
合計ジャッジ時間 | 10,391 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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)