#include<bits/stdc++.h>
using namespace std;
int a,b,c[1000010],d,e,f,g=1,h,i,j,k,l,m;
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<=e; k++)
{if (c[j]>c[k]&&c[j]+c[k]>f){g=0; break;}
}
if (g==0) break;
}
cout<<g<<" ";
g=1;
}
}
Compilation message
sortbooks.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | 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 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
21 ms |
212 KB |
Output is correct |
9 |
Correct |
7 ms |
212 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
# |
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 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
21 ms |
212 KB |
Output is correct |
9 |
Correct |
7 ms |
212 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
17 ms |
336 KB |
Output is correct |
12 |
Correct |
131 ms |
344 KB |
Output is correct |
13 |
Correct |
87 ms |
348 KB |
Output is correct |
14 |
Correct |
196 ms |
340 KB |
Output is correct |
15 |
Correct |
133 ms |
352 KB |
Output is correct |
16 |
Execution timed out |
3091 ms |
300 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
421 ms |
6164 KB |
Output is correct |
2 |
Correct |
430 ms |
6244 KB |
Output is correct |
3 |
Correct |
429 ms |
6148 KB |
Output is correct |
4 |
Correct |
454 ms |
6192 KB |
Output is correct |
5 |
Execution timed out |
3097 ms |
4156 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3080 ms |
596 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 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
21 ms |
212 KB |
Output is correct |
9 |
Correct |
7 ms |
212 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
17 ms |
336 KB |
Output is correct |
12 |
Correct |
131 ms |
344 KB |
Output is correct |
13 |
Correct |
87 ms |
348 KB |
Output is correct |
14 |
Correct |
196 ms |
340 KB |
Output is correct |
15 |
Correct |
133 ms |
352 KB |
Output is correct |
16 |
Execution timed out |
3091 ms |
300 KB |
Time limit exceeded |
17 |
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 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
21 ms |
212 KB |
Output is correct |
9 |
Correct |
7 ms |
212 KB |
Output is correct |
10 |
Correct |
9 ms |
212 KB |
Output is correct |
11 |
Correct |
17 ms |
336 KB |
Output is correct |
12 |
Correct |
131 ms |
344 KB |
Output is correct |
13 |
Correct |
87 ms |
348 KB |
Output is correct |
14 |
Correct |
196 ms |
340 KB |
Output is correct |
15 |
Correct |
133 ms |
352 KB |
Output is correct |
16 |
Execution timed out |
3091 ms |
300 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |