結果

問題 No.1438 Broken Drawers
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-10 09:05:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 408 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 931 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 116,132 KB
最終ジャッジ日時 2023-08-19 19:10:43
合計ジャッジ時間 10,117 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,180 KB
testcase_01 AC 69 ms
71,144 KB
testcase_02 AC 68 ms
71,304 KB
testcase_03 AC 69 ms
71,144 KB
testcase_04 AC 70 ms
71,204 KB
testcase_05 AC 70 ms
71,200 KB
testcase_06 AC 181 ms
115,844 KB
testcase_07 AC 173 ms
115,888 KB
testcase_08 AC 71 ms
71,132 KB
testcase_09 AC 70 ms
71,216 KB
testcase_10 AC 70 ms
71,408 KB
testcase_11 AC 83 ms
76,300 KB
testcase_12 AC 171 ms
97,544 KB
testcase_13 AC 227 ms
100,872 KB
testcase_14 AC 140 ms
91,140 KB
testcase_15 AC 351 ms
109,224 KB
testcase_16 AC 307 ms
103,924 KB
testcase_17 AC 361 ms
111,500 KB
testcase_18 AC 394 ms
116,088 KB
testcase_19 AC 403 ms
116,132 KB
testcase_20 AC 404 ms
115,932 KB
testcase_21 AC 391 ms
115,864 KB
testcase_22 AC 406 ms
115,972 KB
testcase_23 AC 408 ms
115,900 KB
testcase_24 AC 402 ms
115,820 KB
testcase_25 AC 402 ms
115,800 KB
testcase_26 AC 408 ms
115,912 KB
testcase_27 AC 408 ms
115,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_left as bl,bisect_right as br
n=int(input())
a=list(map(int,input().split()))
a=[[x,i] for i,x in enumerate(a)]
a.sort(key=lambda x:x[0])
ans=0
ary=[0]*n
for x,i in a:
  if i==n-1:
    ans+=1
    ary[i]=1
  else:
    if ary[i+1]==0:
      ans+=1
      ary[i]=1
print(ans)
0