結果

問題 No.1425 Yet Another Cyclic Shifts Sorting
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-03-12 22:27:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 548 bytes
コンパイル時間 1,174 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 165,864 KB
最終ジャッジ日時 2024-04-22 13:30:42
合計ジャッジ時間 11,499 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,352 KB
testcase_01 AC 38 ms
52,352 KB
testcase_02 AC 40 ms
52,480 KB
testcase_03 AC 39 ms
52,096 KB
testcase_04 AC 39 ms
52,480 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 38 ms
52,352 KB
testcase_08 AC 38 ms
52,224 KB
testcase_09 AC 39 ms
52,224 KB
testcase_10 AC 40 ms
51,840 KB
testcase_11 WA -
testcase_12 AC 38 ms
52,224 KB
testcase_13 AC 39 ms
51,968 KB
testcase_14 WA -
testcase_15 AC 39 ms
52,608 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 39 ms
51,968 KB
testcase_19 AC 38 ms
52,224 KB
testcase_20 AC 39 ms
52,224 KB
testcase_21 AC 39 ms
52,480 KB
testcase_22 AC 216 ms
127,048 KB
testcase_23 AC 94 ms
90,488 KB
testcase_24 AC 85 ms
88,168 KB
testcase_25 AC 228 ms
132,424 KB
testcase_26 AC 277 ms
163,884 KB
testcase_27 AC 245 ms
133,184 KB
testcase_28 AC 295 ms
164,076 KB
testcase_29 AC 128 ms
101,760 KB
testcase_30 AC 108 ms
92,672 KB
testcase_31 AC 294 ms
163,780 KB
testcase_32 AC 114 ms
99,328 KB
testcase_33 AC 59 ms
71,552 KB
testcase_34 AC 132 ms
103,212 KB
testcase_35 AC 261 ms
137,296 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 AC 39 ms
52,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin
import bisect

N = int(stdin.readline())
A = list(map(int,stdin.readline().split()))

nums = []
inds = {}
for i in range(N):
    if A[i] not in inds:
        nums.append(A[i])
        inds[A[i]] = []
    inds[A[i]].append(i)

nums.sort()
ind = 0
ans = 0

for v in nums:

    inds[v].sort()
    nex = ( bisect.bisect_left(inds[v],ind) ) % len(inds[v])

    for j in range(len(inds[v])):

        nexind = inds[v][(nex+j) % len(inds[v])]
        if nexind < ind:
            ans += 1
        ind = nexind

print (ans)
0