結果

問題 No.876 Range Compress Query
ユーザー rkato5680rkato5680
提出日時 2020-08-24 10:18:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 514 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 60,300 KB
最終ジャッジ日時 2024-04-24 01:24:20
合計ジャッジ時間 11,057 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 465 ms
49,244 KB
testcase_01 AC 548 ms
43,500 KB
testcase_02 AC 457 ms
43,764 KB
testcase_03 AC 537 ms
43,608 KB
testcase_04 AC 471 ms
43,504 KB
testcase_05 AC 474 ms
43,756 KB
testcase_06 AC 531 ms
43,756 KB
testcase_07 AC 591 ms
43,732 KB
testcase_08 AC 636 ms
43,608 KB
testcase_09 AC 600 ms
43,612 KB
testcase_10 AC 541 ms
43,504 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

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