結果
| 問題 | 
                            No.1021 Children in Classrooms
                             | 
                    
| コンテスト | |
| ユーザー | 
                             brthyyjp
                         | 
                    
| 提出日時 | 2020-04-10 21:43:51 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 168 ms / 2,000 ms | 
| コード長 | 406 bytes | 
| コンパイル時間 | 503 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 107,136 KB | 
| 最終ジャッジ日時 | 2024-09-15 19:47:00 | 
| 合計ジャッジ時間 | 3,578 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
n, m = map(int, input().split())
A =list(map(int, input().split()))
s = str(input())
from collections import deque
B = deque(A)
for i in range(m):
    if s[i] == 'L':
        x = B.popleft()
        y = B.popleft()
        y += x
        B.appendleft(y)
        B.append(0)
    else:
        x = B.pop()
        y = B.pop()
        y += x
        B.append(y)
        B.appendleft(0)
B = list(B)
print(*B)
            
            
            
        
            
brthyyjp