結果

問題 No.1438 Broken Drawers
ユーザー titiatitia
提出日時 2021-03-26 21:52:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 202 ms
コンパイル使用メモリ 10,648 KB
実行使用メモリ 30,268 KB
最終ジャッジ日時 2023-08-19 08:05:03
合計ジャッジ時間 5,334 ms
ジャッジサーバーID
(参考情報)
judge9 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,768 KB
testcase_02 AC 15 ms
7,836 KB
testcase_03 AC 16 ms
7,828 KB
testcase_04 AC 16 ms
7,796 KB
testcase_05 AC 15 ms
7,768 KB
testcase_06 AC 185 ms
30,028 KB
testcase_07 AC 158 ms
30,032 KB
testcase_08 AC 16 ms
7,836 KB
testcase_09 AC 16 ms
7,836 KB
testcase_10 AC 16 ms
7,844 KB
testcase_11 AC 23 ms
9,336 KB
testcase_12 AC 82 ms
16,544 KB
testcase_13 AC 128 ms
21,976 KB
testcase_14 AC 57 ms
13,992 KB
testcase_15 AC 201 ms
28,104 KB
testcase_16 AC 191 ms
28,720 KB
testcase_17 AC 208 ms
29,976 KB
testcase_18 AC 213 ms
30,168 KB
testcase_19 AC 219 ms
29,376 KB
testcase_20 AC 216 ms
29,444 KB
testcase_21 AC 218 ms
28,788 KB
testcase_22 AC 222 ms
30,268 KB
testcase_23 AC 216 ms
30,028 KB
testcase_24 AC 217 ms
30,120 KB
testcase_25 AC 225 ms
29,972 KB
testcase_26 AC 224 ms
30,040 KB
testcase_27 AC 229 ms
29,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

AINV=[0]*(N+1)
for i in range(N):
    AINV[A[i]]=i

USE=[0]*(N+1)
ANS=0

for i in range(1,N+1):
    if USE[AINV[i]]==1:
        continue
    ANS+=1
    USE[AINV[i]]=1
    USE[AINV[i]-1]=1

print(ANS)
    
0