#include<bits/stdc++.h>
#define ll long long
using namespace std;
int a,b,c[1000005],d,e,f,g,h,i,j,k,l;
main(){ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>a>>b;
for (i=1; i<=a; i++)
{cin>>c[i];
}
for (i=1; i<=b; i++)
{cin>>d>>e>>f;
for (j=d; j<=e; j++)
{
for (k=j+1; k<=(d+e+1)/2; k++)
{if (c[j]>c[k]){if (c[j]+c[k]>f) {cout<<"0"<<endl;g=100; break;}}
}
if (g==100) break;
}
if (g!=100) {cout<<'1'<<endl;}
g=0;
}
}
Compilation message
sortbooks.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
5 | main(){ios::sync_with_stdio(false);
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1643 ms |
6196 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3040 ms |
724 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |