-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeoFdmopc15c4p4.cpp
More file actions
35 lines (32 loc) · 840 Bytes
/
LeoFdmopc15c4p4.cpp
File metadata and controls
35 lines (32 loc) · 840 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 psum[100010];
set<int> occur[2010];
int main()
{
//freopen("DMOPC.txt","r",stdin);
cin.sync_with_stdio(0); cin.tie(0);
int N, K, Q;
cin >> N >> K >> Q;
for (int i=1; i<=N; ++i){
cin >> psum[i];
occur[psum[i]+1000].insert(i);
psum[i]+=psum[i-1];
}
while (Q--){
int x, y, a, b, tot = 0;
cin >> a >> b >> x >> y;
tot = psum[y] - psum[x-1];
auto it = occur[a+1000].lower_bound(x), it2 = occur[b+1000].lower_bound(x);
if (it == occur[a+1000].end() || y < *it || it2 == occur[b+1000].end() || y < *it2){
cout << "No" << '\n';
}
else if (tot > K){
cout << "Yes" << '\n';
}
else{
cout << "No" << '\n';
}
}
return 0;
}