結果

問題 No.365 ジェンガソート
ユーザー ronpooronpoo
提出日時 2023-08-23 10:55:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 86,552 KB
実行使用メモリ 91,884 KB
最終ジャッジ日時 2023-08-23 10:55:57
合計ジャッジ時間 6,233 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,080 KB
testcase_01 AC 71 ms
71,232 KB
testcase_02 AC 69 ms
70,860 KB
testcase_03 AC 71 ms
71,216 KB
testcase_04 AC 69 ms
71,336 KB
testcase_05 AC 71 ms
70,940 KB
testcase_06 AC 72 ms
71,268 KB
testcase_07 AC 72 ms
70,856 KB
testcase_08 AC 71 ms
71,264 KB
testcase_09 AC 76 ms
71,120 KB
testcase_10 AC 72 ms
71,064 KB
testcase_11 AC 70 ms
70,932 KB
testcase_12 AC 72 ms
71,160 KB
testcase_13 AC 71 ms
71,352 KB
testcase_14 AC 71 ms
70,996 KB
testcase_15 AC 70 ms
71,052 KB
testcase_16 AC 98 ms
87,860 KB
testcase_17 AC 103 ms
91,276 KB
testcase_18 AC 83 ms
76,376 KB
testcase_19 AC 103 ms
91,384 KB
testcase_20 AC 88 ms
79,364 KB
testcase_21 AC 82 ms
77,824 KB
testcase_22 AC 93 ms
87,860 KB
testcase_23 AC 86 ms
81,736 KB
testcase_24 AC 93 ms
86,308 KB
testcase_25 AC 81 ms
77,700 KB
testcase_26 AC 90 ms
83,772 KB
testcase_27 AC 99 ms
91,608 KB
testcase_28 AC 89 ms
84,924 KB
testcase_29 AC 96 ms
89,652 KB
testcase_30 AC 90 ms
85,000 KB
testcase_31 AC 97 ms
78,728 KB
testcase_32 AC 83 ms
78,860 KB
testcase_33 AC 98 ms
91,488 KB
testcase_34 AC 82 ms
76,696 KB
testcase_35 AC 94 ms
86,540 KB
testcase_36 AC 98 ms
91,628 KB
testcase_37 AC 97 ms
91,748 KB
testcase_38 AC 99 ms
91,704 KB
testcase_39 AC 104 ms
91,884 KB
testcase_40 AC 101 ms
91,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

m = 0
x = [False]*N
y = [0]*N
for i in range(N):
    if a[i] < m:
        x[i] = True
    m = max(m, a[i])

v = 0
for i in range(N-1, -1, -1):
    if x[i]:
        v = max(v, a[i])
    y[i] = v
        
for i in range(N):
    if a[i] < y[i]:
        x[i] = True
ans = sum(x)
print(ans)
0