結果

問題 No.879 Range Mod 2 Query
ユーザー tko919tko919
提出日時 2019-09-09 02:08:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 936 ms / 3,000 ms
コード長 1,193 bytes
コンパイル時間 2,460 ms
コンパイル使用メモリ 181,004 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-09 22:56:10
合計ジャッジ時間 10,812 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 487 ms
4,380 KB
testcase_12 AC 277 ms
4,380 KB
testcase_13 AC 352 ms
4,380 KB
testcase_14 AC 362 ms
4,380 KB
testcase_15 AC 292 ms
4,380 KB
testcase_16 AC 871 ms
4,384 KB
testcase_17 AC 936 ms
4,388 KB
testcase_18 AC 919 ms
4,380 KB
testcase_19 AC 781 ms
4,380 KB
testcase_20 AC 797 ms
4,380 KB
testcase_21 AC 836 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll; typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A,size_t N,typename T>void Fill(A(&array)[N],const T &val){fill((T*)array, (T*)(array+N), val);}
const int inf = INT_MAX / 2; const ll INF = LLONG_MAX / 2;
//template end



int main(){
    int n,q; scanf("%d%d",&n,&q);
    ll a[100010];
    rep(i,1,n+1)scanf("%d",&a[i]);
    int b,l,r,x; ll res;
    rep(rot,0,q){
        scanf("%d%d%d",&b,&l,&r);
        if(b==1){
            rep(i,l,r+1)a[i]&=1;
        }
        else if(b==2){
            scanf("%d",&x);
            rep(i,l,r+1)a[i]+=x;
        }
        else{
            res=0;
            rep(i,l,r+1)res+=a[i];
            printf("%lld\n",res);
        }
    }
    return 0;
}
0