結果
| 問題 | No.879 Range Mod 2 Query |
| コンテスト | |
| ユーザー |
HIR180
|
| 提出日時 | 2019-09-07 00:53:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,239 ms / 3,000 ms |
| コード長 | 1,137 bytes |
| 記録 | |
| コンパイル時間 | 344 ms |
| コンパイル使用メモリ | 36,824 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-24 23:37:55 |
| 合計ジャッジ時間 | 10,758 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 21 |
ソースコード
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,unsafe-math-optimizations")
#pragma GCC target("avx")
#include <stdio.h>
inline int read_char() {
static char buf[1 << 16], *ptr = buf, *end_ptr = buf;
if (ptr == end_ptr) {
int len = fread(buf, 1, sizeof(buf), stdin);
if (len <= 0) return EOF;
ptr = buf;
end_ptr = buf + len;
}
return *ptr++;
}
inline int read_int() {
int ch; bool sg = 0;
do {
ch = read_char();
if (ch == '-') sg = 1;
} while (ch < '0' || ch > '9');
int x = ch - '0';
while (true) {
ch = read_char();
if (ch < '0' || ch > '9') break;
x = x * 10 + ch - '0';
}
return (sg?-x:x);
}
long long a[100005],ans;
int n,m,t,l,r,x;
int main(){
n=read_int(); m=read_int();
for(int i=1;i<=n;i++) a[i]=read_int();
for(int i=1;i<=m;i++){
t=read_int(); l=read_int(); r=read_int();
if(t == 1){
for(int j=l;j<=r;j++) a[j] &= 1;
}
else if(t == 3){
ans=0;
for(int j=l;j<=r;j++) ans+=a[j];
printf("%lld\n",ans);
}
else{
x=read_int();
for(int j=l;j<=r;j++) a[j] += x;
}
}
}
HIR180