Submission #536103

# Submission time Handle Problem Language Result Execution time Memory
536103 2022-03-12T11:22:29 Z MurotY Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
8 / 100
3000 ms 17872 KB
#include <bits/stdc++.h>
#define ios ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ff first
#define ss second
#define ll long long
using namespace std;
const int N=1e6+7, M=1e9+7;
ll a[N], dp[N];
void solve()
{
	ll n, m, mn=1e18;
	cin >> n >> m;
	for (int i=1;i<=n;i++) cin >> a[i], mn=min(mn, a[i]), dp[i]=1;
	
	for (int i=2;i<=n;i++) {
		if (a[i] >= a[i-1]) dp[i]+=dp[i-1];
		else dp[i]=dp[i-1];
	}
	
	while (m--){
		ll l, r, k;
		cin >> l >> r >> k;
		
		if (mn > k){
			if (dp[r]-dp[l-1] == n) cout <<"1\n";
			else cout << "0\n";
			continue;
		}
		bool ok=1;
		for (int i=l;i<=r;i++){
			for (int j=i+1;j<=r;j++){
				if (a[i] > a[j] && a[i]+a[j] > k){
					ok=0;
					break;
				}
			}
			if (!ok) break;
		}
		cout << ok <<"\n";
	}
	return ;
}
int main()
{
	ios;
	int t=1;
//	cin >> t;
	while (t--){
		solve(); 
		cout <<"\n";
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 22 ms 340 KB Output is correct
9 Correct 7 ms 336 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 22 ms 340 KB Output is correct
9 Correct 7 ms 336 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
11 Correct 16 ms 364 KB Output is correct
12 Correct 134 ms 460 KB Output is correct
13 Correct 84 ms 468 KB Output is correct
14 Correct 197 ms 548 KB Output is correct
15 Correct 124 ms 572 KB Output is correct
16 Execution timed out 3084 ms 468 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 434 ms 17872 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3077 ms 1876 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 22 ms 340 KB Output is correct
9 Correct 7 ms 336 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
11 Correct 16 ms 364 KB Output is correct
12 Correct 134 ms 460 KB Output is correct
13 Correct 84 ms 468 KB Output is correct
14 Correct 197 ms 548 KB Output is correct
15 Correct 124 ms 572 KB Output is correct
16 Execution timed out 3084 ms 468 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 2 ms 340 KB Output is correct
8 Correct 22 ms 340 KB Output is correct
9 Correct 7 ms 336 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
11 Correct 16 ms 364 KB Output is correct
12 Correct 134 ms 460 KB Output is correct
13 Correct 84 ms 468 KB Output is correct
14 Correct 197 ms 548 KB Output is correct
15 Correct 124 ms 572 KB Output is correct
16 Execution timed out 3084 ms 468 KB Time limit exceeded
17 Halted 0 ms 0 KB -