結果

問題 No.1021 Children in Classrooms
ユーザー chocoruskchocorusk
提出日時 2020-04-07 17:54:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 10,556 KB
実行使用メモリ 31,812 KB
最終ジャッジ日時 2023-09-22 02:44:05
合計ジャッジ時間 3,869 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,504 KB
testcase_01 AC 17 ms
8,600 KB
testcase_02 AC 17 ms
8,396 KB
testcase_03 AC 18 ms
8,572 KB
testcase_04 AC 19 ms
8,780 KB
testcase_05 AC 19 ms
8,624 KB
testcase_06 AC 19 ms
8,676 KB
testcase_07 AC 19 ms
8,736 KB
testcase_08 AC 19 ms
8,764 KB
testcase_09 AC 172 ms
31,812 KB
testcase_10 AC 175 ms
31,624 KB
testcase_11 AC 179 ms
31,560 KB
testcase_12 AC 173 ms
30,768 KB
testcase_13 AC 177 ms
30,840 KB
testcase_14 AC 174 ms
31,016 KB
testcase_15 AC 148 ms
24,892 KB
testcase_16 AC 149 ms
25,212 KB
testcase_17 AC 161 ms
25,860 KB
testcase_18 AC 170 ms
30,520 KB
testcase_19 AC 86 ms
8,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n, m=map(int, input().split())
a=deque(map(int, input().split()))
s=input()
for c in s:
    if c=='L':
        a0=a.popleft()
        a1=a.popleft()
        a.appendleft(a0+a1)
        a.append(0)
    else:
        a0=a.pop()
        a1=a.pop()
        a.append(a0+a1)
        a.appendleft(0)
print(' '.join(map(str, a)))
0