結果

問題 No.1021 Children in Classrooms
ユーザー KodaiKodai
提出日時 2020-04-13 20:00:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,120 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 120 ms
コンパイル使用メモリ 11,884 KB
実行使用メモリ 33,784 KB
最終ジャッジ日時 2023-10-25 23:41:46
合計ジャッジ時間 13,344 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,144 KB
testcase_01 AC 28 ms
10,144 KB
testcase_02 AC 28 ms
10,144 KB
testcase_03 AC 30 ms
10,300 KB
testcase_04 AC 30 ms
10,356 KB
testcase_05 AC 30 ms
10,300 KB
testcase_06 AC 32 ms
10,348 KB
testcase_07 AC 31 ms
10,400 KB
testcase_08 AC 32 ms
10,400 KB
testcase_09 AC 1,110 ms
33,776 KB
testcase_10 AC 1,120 ms
33,748 KB
testcase_11 AC 1,096 ms
33,780 KB
testcase_12 AC 1,101 ms
33,784 KB
testcase_13 AC 1,102 ms
33,776 KB
testcase_14 AC 1,119 ms
33,784 KB
testcase_15 AC 683 ms
27,112 KB
testcase_16 AC 692 ms
28,188 KB
testcase_17 AC 758 ms
28,792 KB
testcase_18 AC 1,109 ms
33,024 KB
testcase_19 AC 101 ms
10,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N, M = list(map(int, input().split()))
A_list = deque(list(map(int, input().split())))
S = input()

for i in S:
    if i == "L":
        temp1 = A_list.popleft()
        temp2 = A_list.popleft()
        A_list.appendleft(temp1+temp2)
        A_list.append(0)
    else:
        temp1 = A_list.pop()
        temp2 = A_list.pop()
        A_list.append(temp1+temp2)
        A_list.appendleft(0)

for i in range(len(A_list)-1):
    print(A_list[i], end=" ")
print(A_list[-1])
0