#include <iostream>
using namespace std;
int n, m, w[1000001], wmax, l, r, k;
void read()
{
cin >> n >> m;
for(int i = 1; i <= n; ++i)
cin >> w[i];
}
bool solve()
{
wmax = 0;
cin >> l >> r >> k;
for(int i = l; i <= r; ++i)
{
if(w[i] < wmax && wmax + w[i] > k) return 0;
wmax = max(wmax, w[i]);
}
return 1;
}
int main()
{
read();
while(m--)
cout << solve() << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
7 ms |
204 KB |
Output is correct |
12 |
Correct |
10 ms |
332 KB |
Output is correct |
13 |
Correct |
11 ms |
204 KB |
Output is correct |
14 |
Correct |
12 ms |
332 KB |
Output is correct |
15 |
Correct |
17 ms |
324 KB |
Output is correct |
16 |
Correct |
17 ms |
332 KB |
Output is correct |
17 |
Correct |
17 ms |
324 KB |
Output is correct |
18 |
Correct |
16 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2506 ms |
6076 KB |
Output is correct |
2 |
Correct |
2560 ms |
6272 KB |
Output is correct |
3 |
Correct |
2548 ms |
6176 KB |
Output is correct |
4 |
Correct |
2576 ms |
6104 KB |
Output is correct |
5 |
Execution timed out |
3067 ms |
4464 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
723 ms |
856 KB |
Output is correct |
2 |
Correct |
1933 ms |
816 KB |
Output is correct |
3 |
Correct |
2192 ms |
872 KB |
Output is correct |
4 |
Correct |
1628 ms |
796 KB |
Output is correct |
5 |
Correct |
1314 ms |
860 KB |
Output is correct |
6 |
Correct |
2513 ms |
860 KB |
Output is correct |
7 |
Correct |
2422 ms |
836 KB |
Output is correct |
8 |
Correct |
2482 ms |
904 KB |
Output is correct |
9 |
Correct |
214 ms |
508 KB |
Output is correct |
10 |
Correct |
2826 ms |
860 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
7 ms |
204 KB |
Output is correct |
12 |
Correct |
10 ms |
332 KB |
Output is correct |
13 |
Correct |
11 ms |
204 KB |
Output is correct |
14 |
Correct |
12 ms |
332 KB |
Output is correct |
15 |
Correct |
17 ms |
324 KB |
Output is correct |
16 |
Correct |
17 ms |
332 KB |
Output is correct |
17 |
Correct |
17 ms |
324 KB |
Output is correct |
18 |
Correct |
16 ms |
336 KB |
Output is correct |
19 |
Correct |
2578 ms |
1572 KB |
Output is correct |
20 |
Correct |
2572 ms |
1572 KB |
Output is correct |
21 |
Execution timed out |
3070 ms |
1288 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
2 ms |
204 KB |
Output is correct |
9 |
Correct |
2 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
7 ms |
204 KB |
Output is correct |
12 |
Correct |
10 ms |
332 KB |
Output is correct |
13 |
Correct |
11 ms |
204 KB |
Output is correct |
14 |
Correct |
12 ms |
332 KB |
Output is correct |
15 |
Correct |
17 ms |
324 KB |
Output is correct |
16 |
Correct |
17 ms |
332 KB |
Output is correct |
17 |
Correct |
17 ms |
324 KB |
Output is correct |
18 |
Correct |
16 ms |
336 KB |
Output is correct |
19 |
Correct |
2506 ms |
6076 KB |
Output is correct |
20 |
Correct |
2560 ms |
6272 KB |
Output is correct |
21 |
Correct |
2548 ms |
6176 KB |
Output is correct |
22 |
Correct |
2576 ms |
6104 KB |
Output is correct |
23 |
Execution timed out |
3067 ms |
4464 KB |
Time limit exceeded |