Skip to content

Commit 3b92da7

Browse files
committed
Added 1807D - Odd Queries.cpp
1 parent 8ede2ec commit 3b92da7

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

1807D - Odd Queries.cpp

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
// ॐ नमः शिवाय
2+
#include<bits/stdc++.h>
3+
using namespace std;
4+
#define pb push_back
5+
6+
// Code Written By: Vikash Patel
7+
// Codeforces Profile: https://codeforces.com/profile/vikashpatel
8+
9+
int main()
10+
{
11+
int t;
12+
cin>>t;
13+
while(t--)
14+
{
15+
int n,q;
16+
cin>>n>>q;
17+
int a[n],as[n];
18+
as[0]=0;
19+
for(int i=1;i<=n;i++)
20+
{
21+
cin>>a[i];
22+
as[i]=as[i-1]+a[i];
23+
}
24+
while(q--)
25+
{
26+
int l,r,k;
27+
cin>>l>>r>>k;
28+
int sum = as[n]-as[r]+as[l-1];
29+
//cout<<sum<<endl;
30+
if((sum+(r-l+1)*k)%2!=0)
31+
cout<<"YES"<<endl;
32+
else
33+
cout<<"NO"<<endl;
34+
}
35+
}
36+
return 0;
37+
}

0 commit comments

Comments
 (0)