Submission #498597

# Submission time Handle Problem Language Result Execution time Memory
498597 2021-12-25T15:44:10 Z Ziyoda Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 10520 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n, m;
	cin >> n >> m;
	long long a[n+1], b, mx=0, li, ri, ki;
	for(int i=1; i<=n; i++)
		cin >> a[i];
	for(int i=1; i<=m; i++){
		bool y=0;
		b = 0;
		cin >> li >> ri >> ki;
		for(int e=li; e<=ri; e++){
			if(b<a[e]){
				if(b+mx>ki)
					break;
				mx = 0;
				if(e!=ri && a[e]>a[e+1]){
					y=1; b=a[e];	}
			}
			if(y && a[e]<b)
				mx = max(a[e], mx);
		}
		//cout << b << ' ' << mx << "\n";
		if(b+mx>ki)
			cout << 0 << "\n";
		else
			cout << 1 << "\n";
		mx = 0;
	}
}
# Verdict Execution time Memory 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 300 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 216 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory 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 300 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 216 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 308 KB Output is correct
13 Correct 2 ms 448 KB Output is correct
14 Correct 3 ms 440 KB Output is correct
15 Correct 4 ms 460 KB Output is correct
16 Correct 35 ms 444 KB Output is correct
17 Correct 20 ms 316 KB Output is correct
18 Correct 27 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 520 ms 10008 KB Output is correct
2 Correct 562 ms 10396 KB Output is correct
3 Correct 539 ms 10520 KB Output is correct
4 Correct 565 ms 10420 KB Output is correct
5 Execution timed out 3058 ms 8472 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 631 ms 1684 KB Output is correct
2 Correct 2027 ms 3212 KB Output is correct
3 Execution timed out 3033 ms 2828 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 300 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 216 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 308 KB Output is correct
13 Correct 2 ms 448 KB Output is correct
14 Correct 3 ms 440 KB Output is correct
15 Correct 4 ms 460 KB Output is correct
16 Correct 35 ms 444 KB Output is correct
17 Correct 20 ms 316 KB Output is correct
18 Correct 27 ms 304 KB Output is correct
19 Correct 2196 ms 7436 KB Output is correct
20 Correct 2164 ms 7648 KB Output is correct
21 Execution timed out 3078 ms 5828 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 300 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 216 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 2 ms 308 KB Output is correct
13 Correct 2 ms 448 KB Output is correct
14 Correct 3 ms 440 KB Output is correct
15 Correct 4 ms 460 KB Output is correct
16 Correct 35 ms 444 KB Output is correct
17 Correct 20 ms 316 KB Output is correct
18 Correct 27 ms 304 KB Output is correct
19 Correct 520 ms 10008 KB Output is correct
20 Correct 562 ms 10396 KB Output is correct
21 Correct 539 ms 10520 KB Output is correct
22 Correct 565 ms 10420 KB Output is correct
23 Execution timed out 3058 ms 8472 KB Time limit exceeded