Submission #167876

# Submission time Handle Problem Language Result Execution time Memory
167876 2019-12-10T16:54:17 Z munhorgil Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 13912 KB
#include<bits/stdc++.h>

#define pb push_back

using namespace std;

vector < long long > a;

int Solve(long long l , long long r , long long k)
{
	long long Max = 0;
	
	for(long long c = l - 1 ; c < r ; c++)
	{
		if(a[c] >= Max)
		{
			Max = a[c];
		}
		else
		{
			if(Max + a[c] > k)
			{
				return 0;
			}
		}
	}
	return 1;
}

int main()
{
	long long n , q , i , x , l , r , k;
	
	cin >> n >> q;
	
	for(i = 0 ; i < n ; i++)
	{
		cin >> x;
		
		a.pb(x);
	}
	
	for(i = 0 ; i < q ; i++)
	{
		cin >> l >> r >> k;
		
		cout << Solve(l , r , k) << endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 360 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 360 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 15 ms 376 KB Output is correct
12 Correct 17 ms 476 KB Output is correct
13 Correct 18 ms 632 KB Output is correct
14 Correct 27 ms 640 KB Output is correct
15 Correct 28 ms 632 KB Output is correct
16 Correct 31 ms 632 KB Output is correct
17 Correct 31 ms 504 KB Output is correct
18 Correct 29 ms 508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3016 ms 13912 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 866 ms 2560 KB Output is correct
2 Correct 1801 ms 3548 KB Output is correct
3 Execution timed out 3049 ms 3476 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 360 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 15 ms 376 KB Output is correct
12 Correct 17 ms 476 KB Output is correct
13 Correct 18 ms 632 KB Output is correct
14 Correct 27 ms 640 KB Output is correct
15 Correct 28 ms 632 KB Output is correct
16 Correct 31 ms 632 KB Output is correct
17 Correct 31 ms 504 KB Output is correct
18 Correct 29 ms 508 KB Output is correct
19 Correct 2619 ms 9132 KB Output is correct
20 Correct 2627 ms 9316 KB Output is correct
21 Execution timed out 3060 ms 6588 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 360 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 4 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 15 ms 376 KB Output is correct
12 Correct 17 ms 476 KB Output is correct
13 Correct 18 ms 632 KB Output is correct
14 Correct 27 ms 640 KB Output is correct
15 Correct 28 ms 632 KB Output is correct
16 Correct 31 ms 632 KB Output is correct
17 Correct 31 ms 504 KB Output is correct
18 Correct 29 ms 508 KB Output is correct
19 Execution timed out 3016 ms 13912 KB Time limit exceeded
20 Halted 0 ms 0 KB -