結果
| 問題 | 
                            No.1021 Children in Classrooms
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tamato
                         | 
                    
| 提出日時 | 2020-04-10 21:28:05 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 161 ms / 2,000 ms | 
| コード長 | 534 bytes | 
| コンパイル時間 | 267 ms | 
| コンパイル使用メモリ | 82,560 KB | 
| 実行使用メモリ | 106,240 KB | 
| 最終ジャッジ日時 | 2024-09-15 19:10:43 | 
| 合計ジャッジ時間 | 3,831 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 | 
ソースコード
def main():
    import sys
    from collections import deque
    input = sys.stdin.readline
    N, M = map(int, input().split())
    A = deque(list(map(int, input().split())))
    S = input().rstrip('\n')
    for s in S:
        if s == 'R':
            a1 = A.pop()
            a2 = A.pop()
            A.append(a1+a2)
            A.appendleft(0)
        else:
            a1 = A.popleft()
            a2 = A.popleft()
            A.appendleft(a1 + a2)
            A.append(0)
    print(*A)
if __name__ == '__main__':
    main()
            
            
            
        
            
tamato