#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(){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]){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);
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
22 ms |
212 KB |
Output is correct |
9 |
Correct |
8 ms |
212 KB |
Output is correct |
10 |
Correct |
18 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
22 ms |
212 KB |
Output is correct |
9 |
Correct |
8 ms |
212 KB |
Output is correct |
10 |
Correct |
18 ms |
212 KB |
Output is correct |
11 |
Correct |
21 ms |
340 KB |
Output is correct |
12 |
Correct |
149 ms |
348 KB |
Output is correct |
13 |
Correct |
90 ms |
348 KB |
Output is correct |
14 |
Correct |
206 ms |
356 KB |
Output is correct |
15 |
Correct |
138 ms |
356 KB |
Output is correct |
16 |
Execution timed out |
3069 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1517 ms |
10304 KB |
Output is correct |
2 |
Correct |
1501 ms |
10068 KB |
Output is correct |
3 |
Correct |
1519 ms |
10096 KB |
Output is correct |
4 |
Correct |
1539 ms |
10124 KB |
Output is correct |
5 |
Execution timed out |
3043 ms |
8140 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3088 ms |
1108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
22 ms |
212 KB |
Output is correct |
9 |
Correct |
8 ms |
212 KB |
Output is correct |
10 |
Correct |
18 ms |
212 KB |
Output is correct |
11 |
Correct |
21 ms |
340 KB |
Output is correct |
12 |
Correct |
149 ms |
348 KB |
Output is correct |
13 |
Correct |
90 ms |
348 KB |
Output is correct |
14 |
Correct |
206 ms |
356 KB |
Output is correct |
15 |
Correct |
138 ms |
356 KB |
Output is correct |
16 |
Execution timed out |
3069 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
212 KB |
Output is correct |
7 |
Correct |
2 ms |
212 KB |
Output is correct |
8 |
Correct |
22 ms |
212 KB |
Output is correct |
9 |
Correct |
8 ms |
212 KB |
Output is correct |
10 |
Correct |
18 ms |
212 KB |
Output is correct |
11 |
Correct |
21 ms |
340 KB |
Output is correct |
12 |
Correct |
149 ms |
348 KB |
Output is correct |
13 |
Correct |
90 ms |
348 KB |
Output is correct |
14 |
Correct |
206 ms |
356 KB |
Output is correct |
15 |
Correct |
138 ms |
356 KB |
Output is correct |
16 |
Execution timed out |
3069 ms |
340 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |