結果

問題 No.1021 Children in Classrooms
ユーザー yuly3yuly3
提出日時 2020-05-01 00:14:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 86,740 KB
実行使用メモリ 100,696 KB
最終ジャッジ日時 2023-08-22 21:41:19
合計ジャッジ時間 6,834 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 92 ms
71,412 KB
testcase_01 AC 93 ms
71,592 KB
testcase_02 AC 95 ms
71,360 KB
testcase_03 AC 115 ms
77,292 KB
testcase_04 AC 109 ms
77,356 KB
testcase_05 AC 109 ms
77,620 KB
testcase_06 AC 109 ms
77,580 KB
testcase_07 AC 108 ms
77,728 KB
testcase_08 AC 110 ms
77,188 KB
testcase_09 AC 227 ms
99,280 KB
testcase_10 AC 224 ms
99,460 KB
testcase_11 AC 225 ms
99,548 KB
testcase_12 AC 221 ms
99,468 KB
testcase_13 AC 225 ms
99,540 KB
testcase_14 AC 221 ms
99,612 KB
testcase_15 AC 200 ms
96,524 KB
testcase_16 AC 197 ms
96,408 KB
testcase_17 AC 204 ms
96,468 KB
testcase_18 AC 220 ms
100,696 KB
testcase_19 AC 122 ms
77,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import deque

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    _, _ = map(int, rl().split())
    a = deque(map(int, rl().split()))
    S = input()
    
    for si in S:
        if si == 'L':
            tmp = a.popleft()
            a[0] += tmp
            a.append(0)
        else:
            tmp = a.pop()
            a[-1] += tmp
            a.appendleft(0)
    print(*a)


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