結果

問題 No.876 Range Compress Query
ユーザー tko919tko919
提出日時 2019-09-07 02:51:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 502 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 163,856 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-07 08:08:41
合計ジャッジ時間 14,407 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 TLE -
testcase_12 AC 1,440 ms
4,380 KB
testcase_13 AC 1,593 ms
4,380 KB
testcase_14 AC 1,981 ms
4,384 KB
testcase_15 AC 1,400 ms
4,380 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int n,q; scanf("%d%d",&n,&q);
    int a[100010];
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    int b,l,r,add,ans;
    for(int rot=0;rot<q;rot++){
        scanf("%d%d%d",&b,&l,&r);
        if(b==1){
            scanf("%d",&add);
            for(int i=l-1;i<r;i++)a[i]+=add;
        }
        else{
            ans=1;
            for(int i=l-1;i<r-1;i++)if(a[i]!=a[i+1])ans++;
            printf("%d\n",ans);
        }
    }
    return 0;
}
0