結果

問題 No.1021 Children in Classrooms
ユーザー 👑 tamatotamato
提出日時 2020-04-10 21:28:05
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 752 ms
コンパイル使用メモリ 86,692 KB
実行使用メモリ 111,508 KB
最終ジャッジ日時 2023-10-13 23:19:17
合計ジャッジ時間 4,912 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
71,492 KB
testcase_01 AC 83 ms
71,468 KB
testcase_02 AC 81 ms
71,320 KB
testcase_03 AC 106 ms
77,812 KB
testcase_04 AC 109 ms
77,868 KB
testcase_05 AC 107 ms
77,832 KB
testcase_06 AC 106 ms
77,780 KB
testcase_07 AC 102 ms
77,760 KB
testcase_08 AC 99 ms
77,752 KB
testcase_09 AC 181 ms
111,412 KB
testcase_10 AC 182 ms
111,508 KB
testcase_11 AC 181 ms
111,424 KB
testcase_12 AC 181 ms
111,424 KB
testcase_13 AC 180 ms
110,984 KB
testcase_14 AC 177 ms
111,072 KB
testcase_15 AC 160 ms
102,484 KB
testcase_16 AC 161 ms
102,272 KB
testcase_17 AC 161 ms
103,096 KB
testcase_18 AC 168 ms
111,352 KB
testcase_19 AC 99 ms
76,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    from collections import deque
    input = sys.stdin.readline

    N, M = map(int, input().split())
    A = deque(list(map(int, input().split())))
    S = input().rstrip('\n')

    for s in S:
        if s == 'R':
            a1 = A.pop()
            a2 = A.pop()
            A.append(a1+a2)
            A.appendleft(0)
        else:
            a1 = A.popleft()
            a2 = A.popleft()
            A.appendleft(a1 + a2)
            A.append(0)
    print(*A)


if __name__ == '__main__':
    main()
0