Submission #495466

# Submission time Handle Problem Language Result Execution time Memory
495466 2021-12-18T17:52:44 Z Amer Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
34 / 100
3000 ms 39116 KB
#include <iostream>

using namespace std;

const int maxN = 1000005;

int arr[maxN];

int solve(int start, int finish, int mood)
{
	int maxNum = arr[start - 1];

	for (int i = start; i < finish; i++)
	{
		if (maxNum > arr[i])
		{
			if (arr[i] + maxNum > mood)
			{
				return false;
			}
		}
		else
		{
			maxNum = arr[i];
		}
	}

	return true;
}

int main()
{
    int n, m;

    cin >> n >> m;

	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}

	for (int i = 0; i < m; i++)
	{
		int start, finish, mood;

		cin >> start >> finish >> mood;

		cout << solve(start, finish, mood)<<endl;
	}
}

/*
5 2
3 5 1 8 2
1 3 6
2 5 3
*/
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 284 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 300 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 288 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 284 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 300 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 288 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 10 ms 380 KB Output is correct
12 Correct 9 ms 332 KB Output is correct
13 Correct 9 ms 412 KB Output is correct
14 Correct 13 ms 460 KB Output is correct
15 Correct 12 ms 460 KB Output is correct
16 Correct 17 ms 428 KB Output is correct
17 Correct 22 ms 336 KB Output is correct
18 Correct 20 ms 424 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2731 ms 38076 KB Output is correct
2 Correct 2602 ms 39116 KB Output is correct
3 Correct 2618 ms 38912 KB Output is correct
4 Correct 2547 ms 39068 KB Output is correct
5 Execution timed out 3096 ms 14740 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 729 ms 2864 KB Output is correct
2 Correct 1954 ms 2952 KB Output is correct
3 Correct 1760 ms 2864 KB Output is correct
4 Correct 1289 ms 2860 KB Output is correct
5 Correct 1074 ms 2984 KB Output is correct
6 Correct 1843 ms 2708 KB Output is correct
7 Correct 1862 ms 2904 KB Output is correct
8 Correct 2167 ms 2576 KB Output is correct
9 Correct 193 ms 1704 KB Output is correct
10 Correct 2576 ms 2564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 284 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 300 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 288 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 10 ms 380 KB Output is correct
12 Correct 9 ms 332 KB Output is correct
13 Correct 9 ms 412 KB Output is correct
14 Correct 13 ms 460 KB Output is correct
15 Correct 12 ms 460 KB Output is correct
16 Correct 17 ms 428 KB Output is correct
17 Correct 22 ms 336 KB Output is correct
18 Correct 20 ms 424 KB Output is correct
19 Correct 2530 ms 8068 KB Output is correct
20 Correct 2602 ms 8056 KB Output is correct
21 Execution timed out 3037 ms 5044 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 284 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 300 KB Output is correct
6 Correct 2 ms 204 KB Output is correct
7 Correct 2 ms 288 KB Output is correct
8 Correct 2 ms 204 KB Output is correct
9 Correct 2 ms 204 KB Output is correct
10 Correct 2 ms 204 KB Output is correct
11 Correct 10 ms 380 KB Output is correct
12 Correct 9 ms 332 KB Output is correct
13 Correct 9 ms 412 KB Output is correct
14 Correct 13 ms 460 KB Output is correct
15 Correct 12 ms 460 KB Output is correct
16 Correct 17 ms 428 KB Output is correct
17 Correct 22 ms 336 KB Output is correct
18 Correct 20 ms 424 KB Output is correct
19 Correct 2731 ms 38076 KB Output is correct
20 Correct 2602 ms 39116 KB Output is correct
21 Correct 2618 ms 38912 KB Output is correct
22 Correct 2547 ms 39068 KB Output is correct
23 Execution timed out 3096 ms 14740 KB Time limit exceeded