結果

問題 No.1021 Children in Classrooms
ユーザー stngstng
提出日時 2020-04-11 19:49:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 11,896 KB
実行使用メモリ 33,840 KB
最終ジャッジ日時 2023-10-19 11:33:00
合計ジャッジ時間 4,683 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,084 KB
testcase_01 AC 31 ms
10,084 KB
testcase_02 AC 30 ms
10,084 KB
testcase_03 AC 30 ms
10,268 KB
testcase_04 AC 30 ms
10,344 KB
testcase_05 AC 30 ms
10,264 KB
testcase_06 AC 31 ms
10,328 KB
testcase_07 AC 32 ms
10,404 KB
testcase_08 AC 32 ms
10,380 KB
testcase_09 AC 256 ms
33,828 KB
testcase_10 AC 255 ms
33,800 KB
testcase_11 AC 250 ms
33,836 KB
testcase_12 AC 252 ms
33,836 KB
testcase_13 AC 255 ms
33,832 KB
testcase_14 AC 253 ms
33,840 KB
testcase_15 AC 214 ms
27,052 KB
testcase_16 AC 216 ms
28,124 KB
testcase_17 AC 220 ms
28,868 KB
testcase_18 AC 250 ms
32,960 KB
testcase_19 AC 108 ms
10,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

n,m = map(int,input().split())
ai = [int(i) for i in input().split()]
s = input()

d = deque(ai)

for i in range(m):
    if s[i] == 'L':
        tmp = d.popleft()
        d[0] = d[0]+tmp
        d.append(0)
    else:
        tmp = d.pop()
        d[-1] = d[-1]+tmp
        d.appendleft(0)
        
print(*d)
0