結果

問題 No.2773 Wake up Record 1
ユーザー manoto43manoto43
提出日時 2024-06-07 21:51:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 474 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 87,936 KB
最終ジャッジ日時 2024-06-07 21:51:15
合計ジャッジ時間 2,587 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,096 KB
testcase_01 AC 34 ms
51,456 KB
testcase_02 AC 39 ms
51,712 KB
testcase_03 AC 36 ms
51,584 KB
testcase_04 AC 33 ms
51,584 KB
testcase_05 AC 76 ms
86,852 KB
testcase_06 AC 51 ms
69,248 KB
testcase_07 AC 74 ms
87,424 KB
testcase_08 AC 52 ms
70,144 KB
testcase_09 AC 52 ms
72,320 KB
testcase_10 AC 52 ms
70,272 KB
testcase_11 AC 72 ms
86,272 KB
testcase_12 AC 56 ms
74,624 KB
testcase_13 AC 50 ms
65,792 KB
testcase_14 AC 57 ms
70,528 KB
testcase_15 AC 44 ms
60,416 KB
testcase_16 AC 76 ms
86,528 KB
testcase_17 AC 55 ms
76,544 KB
testcase_18 AC 50 ms
66,432 KB
testcase_19 AC 85 ms
87,936 KB
testcase_20 AC 48 ms
65,664 KB
testcase_21 AC 73 ms
85,376 KB
testcase_22 AC 72 ms
85,760 KB
testcase_23 AC 74 ms
86,732 KB
testcase_24 AC 59 ms
74,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def RLE(A):
    tmp = [[A[0],0]]
    now = 0
    for i in range(len(A)):
        if tmp[now][0] == A[i]:
            tmp[now][1] += 1
        else:
            tmp.append([A[i],1])
            now += 1
    return tmp

def main():
    N = int(input())
    S = input()

    r = RLE(S)
    ans = []
    cnt = 0

    for s,c in r:
        if s == "o":
            ans.append(cnt+1) 
        cnt += c

    print(len(ans))
    print(*ans)


if __name__ == "__main__":
    main()

0