結果

問題 No.1438 Broken Drawers
ユーザー 👑 tamatotamato
提出日時 2021-03-26 21:23:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 181 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 87,584 KB
実行使用メモリ 115,188 KB
最終ジャッジ日時 2023-08-19 06:59:27
合計ジャッジ時間 5,706 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,536 KB
testcase_01 AC 63 ms
71,660 KB
testcase_02 AC 61 ms
71,424 KB
testcase_03 AC 62 ms
71,632 KB
testcase_04 AC 62 ms
71,520 KB
testcase_05 AC 59 ms
71,540 KB
testcase_06 AC 135 ms
113,724 KB
testcase_07 AC 131 ms
114,172 KB
testcase_08 AC 60 ms
71,708 KB
testcase_09 AC 60 ms
71,520 KB
testcase_10 AC 59 ms
71,536 KB
testcase_11 AC 69 ms
76,708 KB
testcase_12 AC 104 ms
99,408 KB
testcase_13 AC 133 ms
114,448 KB
testcase_14 AC 92 ms
91,792 KB
testcase_15 AC 172 ms
111,268 KB
testcase_16 AC 172 ms
113,680 KB
testcase_17 AC 173 ms
111,716 KB
testcase_18 AC 178 ms
113,084 KB
testcase_19 AC 177 ms
113,912 KB
testcase_20 AC 179 ms
113,868 KB
testcase_21 AC 177 ms
112,664 KB
testcase_22 AC 178 ms
114,288 KB
testcase_23 AC 180 ms
114,452 KB
testcase_24 AC 180 ms
114,828 KB
testcase_25 AC 180 ms
114,692 KB
testcase_26 AC 181 ms
114,524 KB
testcase_27 AC 180 ms
115,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

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

    a2i = {a: i for i, a in enumerate(A)}
    A_sorted = sorted(A)
    seen = [0] * N
    ans = 0
    for a in A_sorted:
        i = a2i[a]
        if not seen[i]:
            ans += 1
            if i != 0:
                seen[i-1] = 1
    print(ans)


if __name__ == '__main__':
    main()
0