結果

問題 No.1021 Children in Classrooms
ユーザー rulerruler
提出日時 2020-04-11 00:26:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 170 ms / 2,000 ms
コード長 449 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 30,348 KB
最終ジャッジ日時 2023-10-14 09:30:46
合計ジャッジ時間 3,502 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,584 KB
testcase_01 AC 15 ms
8,452 KB
testcase_02 AC 16 ms
8,456 KB
testcase_03 AC 17 ms
8,712 KB
testcase_04 AC 16 ms
8,704 KB
testcase_05 AC 16 ms
8,784 KB
testcase_06 AC 16 ms
8,820 KB
testcase_07 AC 16 ms
8,768 KB
testcase_08 AC 18 ms
8,684 KB
testcase_09 AC 160 ms
30,168 KB
testcase_10 AC 162 ms
30,096 KB
testcase_11 AC 170 ms
30,116 KB
testcase_12 AC 164 ms
30,112 KB
testcase_13 AC 157 ms
30,100 KB
testcase_14 AC 162 ms
30,188 KB
testcase_15 AC 130 ms
24,808 KB
testcase_16 AC 130 ms
25,052 KB
testcase_17 AC 135 ms
25,880 KB
testcase_18 AC 153 ms
30,348 KB
testcase_19 AC 44 ms
8,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque

n, m = map(int, sys.stdin.readline().split())
a = deque(map(int, sys.stdin.readline().split()))
s = sys.stdin.readline().rstrip()

def main():

    for c in s:
        if c == 'L':  
            b = a.popleft()
            a.append(0)
            a[0] += b
        else:
            b = a.pop()
            a.appendleft(0)
            a[-1] += b
    print(*a, sep=' ')

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