#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;
int32_t main() {
LCBorz;
int n,q;cin>>n>>q;
vector<int> v(n);
for(int i=0;i<n;i++){
cin>>v[i];
}
for(int i=0;i<q;i++){
int l,r,c;cin>>l>>r>>c;
l--,r--;
int flag=1;
for(int j=l;j<=r;j++){
for(int k=j+1;k<=r;k++){
if(v[j]<=v[k])continue;
if(v[j]+v[k]>c)flag=0;
}
}
cout<<flag<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
472 KB |
Output is correct |
7 |
Correct |
22 ms |
348 KB |
Output is correct |
8 |
Correct |
35 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
472 KB |
Output is correct |
10 |
Correct |
23 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
472 KB |
Output is correct |
7 |
Correct |
22 ms |
348 KB |
Output is correct |
8 |
Correct |
35 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
472 KB |
Output is correct |
10 |
Correct |
23 ms |
348 KB |
Output is correct |
11 |
Correct |
1032 ms |
516 KB |
Output is correct |
12 |
Execution timed out |
3030 ms |
504 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3065 ms |
8284 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3063 ms |
1116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
472 KB |
Output is correct |
7 |
Correct |
22 ms |
348 KB |
Output is correct |
8 |
Correct |
35 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
472 KB |
Output is correct |
10 |
Correct |
23 ms |
348 KB |
Output is correct |
11 |
Correct |
1032 ms |
516 KB |
Output is correct |
12 |
Execution timed out |
3030 ms |
504 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
21 ms |
472 KB |
Output is correct |
7 |
Correct |
22 ms |
348 KB |
Output is correct |
8 |
Correct |
35 ms |
348 KB |
Output is correct |
9 |
Correct |
8 ms |
472 KB |
Output is correct |
10 |
Correct |
23 ms |
348 KB |
Output is correct |
11 |
Correct |
1032 ms |
516 KB |
Output is correct |
12 |
Execution timed out |
3030 ms |
504 KB |
Time limit exceeded |
13 |
Halted |
0 ms |
0 KB |
- |