#include <bits/stdc++.h>
using namespace std;
signed main() {
int n,m;cin>>n>>m;
vector<int> a(n);
for (auto &x:a)cin>>x;
for (int i=0;i<m;i++) {
vector<int> tmp;
int l, r,k;cin>>l>>r>>k;l--;r--;
for (int j=l;j<=r;j++) {
tmp.push_back(a[j]);
}
vector<int> tmp2 = tmp;
sort(tmp.begin(), tmp.end());
int ans = 0;
for (int j=0;j<(int)tmp.size();j++) {
if (tmp[j] != tmp2[j]) {
ans = max(ans, max(tmp[j], tmp2[j]));
}
}
if (k >= ans) cout<<"1\n";
else cout<<"0\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3040 ms |
11800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3041 ms |
1924 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |