結果

問題 No.365 ジェンガソート
ユーザー buey_tbuey_t
提出日時 2023-03-29 09:51:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 1,333 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,592 KB
実行使用メモリ 102,968 KB
最終ジャッジ日時 2023-10-21 02:38:49
合計ジャッジ時間 8,570 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
84,336 KB
testcase_01 AC 137 ms
84,340 KB
testcase_02 AC 134 ms
84,348 KB
testcase_03 AC 133 ms
84,344 KB
testcase_04 AC 136 ms
84,352 KB
testcase_05 AC 134 ms
84,348 KB
testcase_06 AC 133 ms
84,352 KB
testcase_07 AC 133 ms
84,348 KB
testcase_08 AC 134 ms
84,348 KB
testcase_09 AC 136 ms
84,348 KB
testcase_10 AC 139 ms
84,344 KB
testcase_11 AC 134 ms
84,352 KB
testcase_12 AC 134 ms
84,352 KB
testcase_13 AC 135 ms
84,344 KB
testcase_14 AC 134 ms
84,348 KB
testcase_15 AC 135 ms
84,348 KB
testcase_16 AC 164 ms
99,120 KB
testcase_17 AC 167 ms
102,716 KB
testcase_18 AC 149 ms
88,992 KB
testcase_19 AC 167 ms
102,696 KB
testcase_20 AC 152 ms
91,164 KB
testcase_21 AC 152 ms
89,688 KB
testcase_22 AC 161 ms
99,084 KB
testcase_23 AC 157 ms
93,204 KB
testcase_24 AC 160 ms
97,808 KB
testcase_25 AC 150 ms
89,336 KB
testcase_26 AC 157 ms
95,284 KB
testcase_27 AC 171 ms
102,764 KB
testcase_28 AC 161 ms
96,444 KB
testcase_29 AC 166 ms
100,920 KB
testcase_30 AC 157 ms
96,484 KB
testcase_31 AC 154 ms
90,504 KB
testcase_32 AC 153 ms
90,480 KB
testcase_33 AC 169 ms
102,736 KB
testcase_34 AC 150 ms
88,900 KB
testcase_35 AC 158 ms
97,820 KB
testcase_36 AC 170 ms
102,964 KB
testcase_37 AC 166 ms
102,828 KB
testcase_38 AC 166 ms
102,828 KB
testcase_39 AC 168 ms
102,968 KB
testcase_40 AC 167 ms
102,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial,fsum
    from heapq import heapify, heappop, heappush
    from bisect import bisect_left, bisect_right
    from copy import deepcopy
    import copy
    import random
    from collections import deque,Counter,defaultdict
    from itertools import permutations,combinations
    from decimal import Decimal,ROUND_HALF_UP
    #tmp = Decimal(mid).quantize(Decimal('0'), rounding=ROUND_HALF_UP)
    from functools import lru_cache, reduce
    #@lru_cache(maxsize=None)
    from operator import add,sub,mul,xor,and_,or_,itemgetter
    INF = 10**18
    mod1 = 10**9+7
    mod2 = 998244353
    
    #DecimalならPython
    #再帰ならPython!!!!!!!!!!!!!!!!!!!!!!!!!!
    
    
    '''
    
    
    
    '''
    
    N = int(input())
    A = list(map(int, input().split()))
    
    memo = [0]*(N+1)
    memo[0] = INF
    
    for i in range(N):
        memo[A[i]] = memo[A[i]-1]+1
    
    cnt = 0
    for i in reversed(range(1,N+1)):
        cnt += 1
        if memo[i-1] != memo[i]-1:
            break
    
    print(N-cnt)
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
if __name__ == '__main__':
    main()
0