#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c[2000000],d,e,f,g,h,i,j,k,l;
main(){
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]){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(){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
30 ms |
212 KB |
Output is correct |
9 |
Correct |
11 ms |
312 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
30 ms |
212 KB |
Output is correct |
9 |
Correct |
11 ms |
312 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
11 |
Correct |
23 ms |
340 KB |
Output is correct |
12 |
Correct |
144 ms |
428 KB |
Output is correct |
13 |
Correct |
97 ms |
448 KB |
Output is correct |
14 |
Correct |
207 ms |
476 KB |
Output is correct |
15 |
Correct |
137 ms |
444 KB |
Output is correct |
16 |
Execution timed out |
3072 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2473 ms |
10124 KB |
Output is correct |
2 |
Correct |
2519 ms |
10116 KB |
Output is correct |
3 |
Correct |
2468 ms |
10112 KB |
Output is correct |
4 |
Correct |
2439 ms |
10088 KB |
Output is correct |
5 |
Execution timed out |
3096 ms |
8056 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3069 ms |
980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
30 ms |
212 KB |
Output is correct |
9 |
Correct |
11 ms |
312 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
11 |
Correct |
23 ms |
340 KB |
Output is correct |
12 |
Correct |
144 ms |
428 KB |
Output is correct |
13 |
Correct |
97 ms |
448 KB |
Output is correct |
14 |
Correct |
207 ms |
476 KB |
Output is correct |
15 |
Correct |
137 ms |
444 KB |
Output is correct |
16 |
Execution timed out |
3072 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
3 ms |
212 KB |
Output is correct |
8 |
Correct |
30 ms |
212 KB |
Output is correct |
9 |
Correct |
11 ms |
312 KB |
Output is correct |
10 |
Correct |
15 ms |
212 KB |
Output is correct |
11 |
Correct |
23 ms |
340 KB |
Output is correct |
12 |
Correct |
144 ms |
428 KB |
Output is correct |
13 |
Correct |
97 ms |
448 KB |
Output is correct |
14 |
Correct |
207 ms |
476 KB |
Output is correct |
15 |
Correct |
137 ms |
444 KB |
Output is correct |
16 |
Execution timed out |
3072 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |