結果

問題 No.1021 Children in Classrooms
ユーザー uni_pythonuni_python
提出日時 2020-07-07 23:39:03
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 87,172 KB
実行使用メモリ 107,796 KB
最終ジャッジ日時 2023-07-25 02:57:53
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,668 KB
testcase_01 AC 95 ms
71,796 KB
testcase_02 AC 93 ms
71,796 KB
testcase_03 AC 110 ms
77,928 KB
testcase_04 AC 107 ms
77,944 KB
testcase_05 AC 108 ms
77,752 KB
testcase_06 AC 110 ms
77,704 KB
testcase_07 AC 107 ms
77,752 KB
testcase_08 AC 105 ms
77,880 KB
testcase_09 AC 193 ms
106,936 KB
testcase_10 AC 193 ms
107,020 KB
testcase_11 AC 191 ms
106,972 KB
testcase_12 AC 192 ms
107,052 KB
testcase_13 AC 189 ms
107,008 KB
testcase_14 AC 191 ms
106,976 KB
testcase_15 AC 168 ms
101,436 KB
testcase_16 AC 167 ms
101,004 KB
testcase_17 AC 171 ms
101,212 KB
testcase_18 AC 176 ms
107,796 KB
testcase_19 AC 108 ms
77,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,M=MI()
    A=LI()
    from collections import deque
    dq=deque(A)
    
    S=input()
    for i in range(M):
        if S[i]=="L":
            a=dq.popleft()
            b=dq.popleft()
            dq.appendleft(a+b)
            dq.append(0)
        else:
            a=dq.pop()
            b=dq.pop()
            dq.append(a+b)
            dq.appendleft(0)
        
    ans=[]    
    for i in range(N):
        ans.append(dq.popleft())
        
    print(' '.join(map(str, ans)))
            
            
 
        
        


main()
0