結果

問題 No.833 かっこいい電車
ユーザー pengincoalition
提出日時 2019-06-22 10:32:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 663 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 39,408 KB
最終ジャッジ日時 2024-07-02 03:59:36
合計ジャッジ時間 6,968 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

N,Q=tuple(map(int,input().split(' ')))

a=list(map(int,input().split(' ')))

ac=[False for i in range(len(a))]

q=[]

for i in range(Q):
    temp=input().split(" ")
    q.append([int(temp[0]),int(temp[1])-1])


for e in q:
    if e[0]==1:
        ac[e[1]]=True
    if e[0]==2:
        ac[e[1]]=False
    if e[0]==3:
        a[e[1]]+=1
    if e[0]==4:
        A=0
#        print(e[1],list(range(e[1],-1,-1)))
        for i in range(e[1]-1,-1,-1):
            if not ac[i]:
                break
            A+=a[i]
        for i in range(e[1],len(ac)-1,1):
            if not ac[i]:
                break
            A+=a[i+1]
        A+=a[e[1]]
        print(A)
0