結果
問題 |
No.879 Range Mod 2 Query
|
ユーザー |
![]() |
提出日時 | 2019-09-06 23:24:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,663 ms / 3,000 ms |
コード長 | 654 bytes |
コンパイル時間 | 3,146 ms |
コンパイル使用メモリ | 213,536 KB |
最終ジャッジ日時 | 2025-01-07 16:59:22 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d %d", &N, &Q); | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | scanf("%lld", &A[i]); | ~~~~~^~~~~~~~~~~~~~~ main.cpp:22:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | scanf("%d %d %d", &a, &b, &c); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:27:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d", &d); | ~~~~~^~~~~~~~~~
ソースコード
// とおってー! #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); } } }