結果
| 問題 |
No.2879 Range Flip Queries
|
| コンテスト | |
| ユーザー |
タニー
|
| 提出日時 | 2024-09-08 12:37:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 494 ms / 2,000 ms |
| コード長 | 2,218 bytes |
| コンパイル時間 | 1,892 ms |
| コンパイル使用メモリ | 180,868 KB |
| 実行使用メモリ | 11,208 KB |
| 最終ジャッジ日時 | 2024-09-08 12:37:21 |
| 合計ジャッジ時間 | 13,910 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> v;
typedef vector<pair<ll,ll>> p;
typedef string str;
typedef double dou;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define f0r(i,b) FOR(i,0,b)
#define SORT(a) sort(a.begin(),a.end());
#define llin(a,n) f0r(i,n) {cin>>a[i];}
#define vin(a,n) f0r(i,n) {ll tmp;cin>>tmp;a.push_back(tmp);}
#define douketa(n) cout<<fixed<<setprecision(n);
str ALP="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
str alp="abcdefghijklmnopqrstuvwxyz";
dou pi=3.141592653589793;
const ll mod=1000000007;
//aの要素の内、b以下で最大数出力
ll upp(v a,ll b) {return upper_bound(a.begin(),a.end(),b)-a.begin();}
//aの要素の内、b未満で最大数出力
ll low(v a,ll b) {return lower_bound(a.begin(),a.end(),b)-a.begin();}
// a/c(mod n)を出力
ll modinv(ll a,ll c) {ll b=mod,u=1,v=0;while(b){ll t=c/b;c-=t*b;swap(c,b);u-=t*v;swap(u,v);}u%=mod;if(u<0)u+=mod;ll ans=(a%mod)*u%mod;return ans;}
// aCb(mod n)を出力
ll com(ll a,ll b){ll l=1;f0r(i,b){l*=(a-i);l=l%mod;l=modinv(l,i+1);}return l;}
//nが素数かどうか判定
bool priyn(ll n){bool b=true;for(ll i=2;i*i<=n;i++){if(n%i==0) b=false;}return b;}
// nを素因数分解
p ftz(ll n){ll mema=n; map<ll,ll> mem;for(ll i=2;i*i<=mema;i++){while(mema%i==0){mema/=i;mem[i]++;}}if(mema!=1) mem[mema]++;p ret(mem.begin(),mem.end());return ret;}
//yes or no 出力
void yn(bool b){if(b) cout<<"Yes";else cout<<"No"; cout<<endl;}
//'s'ならスペース 'e'なら改行して出力
void vout(v a,char c){
if(c=='s'){
f0r(i,a.size()) cout<<a[i]<<" ";
cout<<endl;}
else if(c=='e'){
f0r(i,a.size()) cout<<a[i]<<endl;
}
}
// void vout(v a,char c){if(c=='s'){f0r(i,a.size()) cout<<a[i]<<" ";}else if(c=='e'){f0r(i,a.size()) cout<<a[i]<<endl;}}
// pを{a,b}出力
void pout(p pa) {f0r(i,pa.size()) cout<<"{"<<pa[i].first<<","<<pa[i].second<<"}"<<endl;}
/*
0~3199 3200~3999
4400 4401
*/
int main(){
ll n,q;
cin>>n>>q;
ll a[n];
llin(a,n);
v mem(n+1,0);
f0r(i,q){
ll a,b;
cin>>a>>b;
a--;
mem[a]++;
mem[b]--;
}
ll ans=0;
f0r(i,n){
ans+=mem[i];
cout<<(ans+a[i])%2<<" ";
}
}
タニー