Submission #167862

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

#define pb push_back

using namespace std;

vector < long long > a;

bool Solve(long long l , long long r , long long k)
{
	long long Max = 0;
	
	for(int 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 376 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 3 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 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 Incorrect 4 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 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 3 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 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 Incorrect 4 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3023 ms 14940 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 851 ms 2536 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 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 3 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 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 Incorrect 4 ms 376 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 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 3 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 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 Incorrect 4 ms 376 KB Output isn't correct