#include <bits/stdc++.h>
using namespace std;
const int mxn = 55;
int a[mxn], n, m;
int b[mxn];
void go() {
cin >> n >> m;
for(int i = 1; i <= n; i++)
cin >> a[i];
while(m--) {
int l, r, k;
cin >> l >> r >> k;
for(int i = 1; i <= n; i++)
b[i] = a[i];
bool sus = 0;
for(int i = l; i <= r && !sus; i++)
for(int j = l; j < r; j++) {
if(a[j] > a[j + 1]) {
if(a[j] + a[j + 1] > k) {
cout << "0\n";
sus = 1;
break;
}
swap(a[j], a[j + 1]);
}
}
if(!sus)
cout << "1\n";
}
}
int main() {
int T = 1;
while(T--)
go();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
4 |
Halted |
0 ms |
0 KB |
- |