結果
| 問題 | No.876 Range Compress Query |
| コンテスト | |
| ユーザー |
tko919
|
| 提出日時 | 2019-09-07 02:51:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 502 bytes |
| 記録 | |
| コンパイル時間 | 1,742 ms |
| コンパイル使用メモリ | 167,680 KB |
| 実行使用メモリ | 13,884 KB |
| 最終ジャッジ日時 | 2024-06-25 02:30:45 |
| 合計ジャッジ時間 | 12,958 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 15 TLE * 1 -- * 2 |
ソースコード
#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;
}
tko919