結果

問題 No.1438 Broken Drawers
ユーザー 37zigen37zigen
提出日時 2021-03-26 21:42:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 586 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 30,664 KB
最終ジャッジ日時 2023-08-19 07:48:43
合計ジャッジ時間 6,418 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,808 KB
testcase_01 AC 15 ms
7,952 KB
testcase_02 AC 16 ms
7,948 KB
testcase_03 AC 16 ms
7,900 KB
testcase_04 AC 16 ms
7,796 KB
testcase_05 AC 16 ms
7,820 KB
testcase_06 AC 229 ms
29,808 KB
testcase_07 AC 190 ms
29,892 KB
testcase_08 AC 16 ms
7,808 KB
testcase_09 AC 16 ms
7,936 KB
testcase_10 AC 17 ms
7,876 KB
testcase_11 AC 25 ms
9,176 KB
testcase_12 AC 98 ms
16,652 KB
testcase_13 AC 149 ms
21,736 KB
testcase_14 AC 68 ms
14,136 KB
testcase_15 AC 233 ms
29,300 KB
testcase_16 AC 229 ms
27,628 KB
testcase_17 AC 240 ms
29,988 KB
testcase_18 AC 255 ms
30,136 KB
testcase_19 AC 257 ms
30,240 KB
testcase_20 AC 254 ms
30,632 KB
testcase_21 AC 248 ms
30,044 KB
testcase_22 AC 259 ms
30,664 KB
testcase_23 AC 257 ms
29,852 KB
testcase_24 AC 260 ms
29,908 KB
testcase_25 AC 257 ms
29,952 KB
testcase_26 AC 258 ms
29,884 KB
testcase_27 AC 258 ms
30,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

index = [None] * N

for i in range(N):
    A[i] -= 1

for i in range(N):
    index[A[i]] = i

ok = [True] * N

ans = 0
for i in range(N):
    if not ok[index[i]]:
        continue
    ok[index[i]] = False
    if index[i] > 0:
        ok[index[i] - 1] = False
    ans += 1

print(ans)
0