-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1807D.cpp
More file actions
35 lines (27 loc) · 731 Bytes
/
1807D.cpp
File metadata and controls
35 lines (27 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--) {
int n, q;
cin >> n >> q;
vector<long long> a(n), prefix(n + 1, 0);
for (int i = 0; i < n; i++) {
cin >> a[i];
prefix[i + 1] = prefix[i] + a[i];
}
long long totalSum = prefix[n];
while (q--) {
int l, r;
long long k;
cin >> l >> r >> k;
long long rangeSum = prefix[r] - prefix[l - 1];
long long newSum = totalSum - rangeSum + k * (r - l + 1);
cout << (newSum % 2 ? "YES\n" : "NO\n");
}
}
return 0;
}