結果

問題 No.1021 Children in Classrooms
コンテスト
ユーザー cologne
提出日時 2025-12-12 16:31:32
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 127 ms / 2,000 ms
+ 141µs
コード長 549 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 222 ms
コンパイル使用メモリ 96,492 KB
実行使用メモリ 105,524 KB
最終ジャッジ日時 2026-07-19 10:43:17
合計ジャッジ時間 4,103 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
from collections import deque


def input(): return sys.stdin.readline().rstrip('\n')


def main():
    n, m = map(int, input().split())
    a = deque(map(int, input().split()))
    for i in input():
        if i == 'L':
            l1, l2 = a.popleft(), a.popleft()
            a.appendleft(l1 + l2)
            a.append(0)
        else:
            r1, r2 = a.pop(), a.pop()
            a.append(r1 + r2)
            a.appendleft(0)
    print(*a)


if __name__ == '__main__':
    ret = main()
    if ret is not None:
        print(ret)
0