結果

問題 No.2092 Conjugation
ユーザー lloyzlloyz
提出日時 2022-10-07 21:52:42
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 25,204 KB
最終ジャッジ日時 2023-09-03 01:34:10
合計ジャッジ時間 3,745 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,876 KB
testcase_01 AC 16 ms
7,808 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 16 ms
7,804 KB
testcase_04 AC 16 ms
7,780 KB
testcase_05 AC 16 ms
7,764 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 76 ms
10,788 KB
testcase_08 AC 155 ms
17,756 KB
testcase_09 AC 109 ms
13,876 KB
testcase_10 AC 118 ms
15,068 KB
testcase_11 AC 118 ms
15,164 KB
testcase_12 AC 108 ms
14,012 KB
testcase_13 AC 85 ms
11,612 KB
testcase_14 AC 81 ms
11,316 KB
testcase_15 AC 107 ms
14,020 KB
testcase_16 AC 181 ms
19,956 KB
testcase_17 AC 134 ms
19,692 KB
testcase_18 AC 222 ms
25,204 KB
testcase_19 AC 53 ms
9,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

C = [(0, 0)]
for i in range(n - 1, -1, -1):
    if i == n - 1:
        prev_b = A[i]
        seq_n = 1
    else:
        if A[i] == prev_b:
            seq_n += 1
        else:
            C.append((prev_b, seq_n))
            prev_b = A[i]
            seq_n = 1
    if i == 0:
        C.append((prev_b, seq_n))
m = len(C)
ANS = [0 for _ in range(A[0])]
curr_b = n
row_n = 0
cidx = 0
for i in range(1, m):
    block_n, decrease_n = C[i]
    for _ in range(block_n - row_n):
        ANS[cidx] = curr_b
        cidx += 1
    row_n = block_n
    curr_b -= decrease_n
print(*ANS)
0