結果
問題 | No.879 Range Mod 2 Query |
ユーザー | 👑 hos.lyric |
提出日時 | 2019-09-06 22:45:22 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,511 ms / 3,000 ms |
コード長 | 1,578 bytes |
コンパイル時間 | 1,709 ms |
コンパイル使用メモリ | 106,108 KB |
実行使用メモリ | 4,404 KB |
最終ジャッジ日時 | 2023-09-07 03:37:21 |
合計ジャッジ時間 | 15,358 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 2 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,380 KB |
testcase_09 | AC | 2 ms
4,380 KB |
testcase_10 | AC | 2 ms
4,376 KB |
testcase_11 | AC | 775 ms
4,380 KB |
testcase_12 | AC | 441 ms
4,380 KB |
testcase_13 | AC | 559 ms
4,380 KB |
testcase_14 | AC | 577 ms
4,380 KB |
testcase_15 | AC | 458 ms
4,380 KB |
testcase_16 | AC | 1,406 ms
4,404 KB |
testcase_17 | AC | 1,511 ms
4,380 KB |
testcase_18 | AC | 1,471 ms
4,388 KB |
testcase_19 | AC | 1,202 ms
4,380 KB |
testcase_20 | AC | 1,238 ms
4,380 KB |
testcase_21 | AC | 1,292 ms
4,384 KB |
ソースコード
#pragma GCC optimize ("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target ("avx") #include <cassert> #include <cmath> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <iostream> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> using namespace std; using Int = long long; template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; }; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; } template <class T> void chmin(T &t, const T &f) { if (t > f) t = f; } template <class T> void chmax(T &t, const T &f) { if (t < f) t = f; } int N, Q; Int a[100010]; int main() { for (; ~scanf("%d%d", &N, &Q); ) { for (int i = 0; i < N; ++i) { scanf("%lld", &a[i]); } for (int q = 0; q < Q; ++q) { int typ, l, r; scanf("%d%d%d", &typ, &l, &r); --l; if (typ == 1) { for (int i = l; i < r; ++i) { a[i] %= 2; } } else if (typ == 2) { Int x; scanf("%lld", &x); for (int i = l; i < r; ++i) { a[i] += x; } } else { Int ans = 0; for (int i = l; i < r; ++i) { ans += a[i]; } printf("%lld\n", ans); } } } return 0; }