結果

問題 No.1021 Children in Classrooms
ユーザー NoviNovi
提出日時 2020-06-06 15:20:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 227 ms / 2,000 ms
コード長 408 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 31,340 KB
最終ジャッジ日時 2023-08-25 01:07:13
合計ジャッジ時間 5,925 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,444 KB
testcase_01 AC 18 ms
8,480 KB
testcase_02 AC 19 ms
8,564 KB
testcase_03 AC 21 ms
8,732 KB
testcase_04 AC 20 ms
8,844 KB
testcase_05 AC 19 ms
8,704 KB
testcase_06 AC 20 ms
8,760 KB
testcase_07 AC 20 ms
8,728 KB
testcase_08 AC 20 ms
8,696 KB
testcase_09 AC 223 ms
30,956 KB
testcase_10 AC 227 ms
30,944 KB
testcase_11 AC 226 ms
31,032 KB
testcase_12 AC 223 ms
31,036 KB
testcase_13 AC 219 ms
31,112 KB
testcase_14 AC 223 ms
31,096 KB
testcase_15 AC 184 ms
25,628 KB
testcase_16 AC 187 ms
25,716 KB
testcase_17 AC 191 ms
26,632 KB
testcase_18 AC 217 ms
31,340 KB
testcase_19 AC 95 ms
8,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import  deque
n,m=map(int,input().split())
a=list(map(int,input().split()))
a=deque(a)
S=input()
for s in S:
    if s=="L":
        first=a.popleft()
        second=a.popleft()
        after=first+second
        a.appendleft(after)
        a.append(0)
    else:
        first=a.pop()
        second=a.pop()
        after=first+second
        a.append(after)
        a.appendleft(0)
print(*a)
0