結果

問題 No.879 Range Mod 2 Query
ユーザー ei1333333ei1333333
提出日時 2019-09-06 23:24:25
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,595 ms / 3,000 ms
コード長 654 bytes
コンパイル時間 3,373 ms
コンパイル使用メモリ 211,504 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-07 03:53:33
合計ジャッジ時間 16,735 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 784 ms
4,388 KB
testcase_12 AC 445 ms
4,380 KB
testcase_13 AC 565 ms
4,380 KB
testcase_14 AC 577 ms
4,380 KB
testcase_15 AC 468 ms
4,384 KB
testcase_16 AC 1,416 ms
4,504 KB
testcase_17 AC 1,523 ms
4,444 KB
testcase_18 AC 1,505 ms
4,384 KB
testcase_19 AC 1,498 ms
4,384 KB
testcase_20 AC 1,528 ms
4,380 KB
testcase_21 AC 1,595 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// とおってー!

#pragma GCC optimize ("O3")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

using namespace std;

using int64 = long long;


int main() {
  int N, Q;
  int64 A[100000];
  scanf("%d %d", &N, &Q);
  for(int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  for(int i = 0; i < Q; i++) {
    int a, b, c, d;
    scanf("%d %d %d", &a, &b, &c);
    --b;
    if(a == 1) {
      for(int j = b; j < c; j++) A[j] &= 1;
    } else if(a == 2) {
      scanf("%d", &d);
      for(int j = b; j < c; j++) A[j] += d;
    } else {
      int64 ret = 0;
      for(int j = b; j < c; j++) ret += A[j];
      printf("%lld\n", ret);
    }
  }
}

0