結果

問題 No.876 Range Compress Query
ユーザー rkato5680
提出日時 2020-08-24 10:18:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 61,872 KB
最終ジャッジ日時 2024-11-06 08:00:59
合計ジャッジ時間 12,712 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 10 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

sys.setrecursionlimit(10**8)

N,Q=map(int,readline().split())
*a,=map(int,readline().split())
a = np.array([0]+a)

def F(x,y):
    if x == y:
        return 1
    else:
        return G(a[x],a[x+1])+F(x+1,y)

def G(x,y):
    return x != y

for i in range(Q):
    *q, = map(int,input().split())
    if q[0]==1:
        a[q[1]:q[2]+1] += q[3]
    else:
        print(F(q[1],q[2]))
0