Submission #1004906

# Submission time Handle Problem Language Result Execution time Memory
1004906 2024-06-22T00:11:30 Z ByeWorld Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++14
17 / 100
3000 ms 47468 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3", "unroll-loops")
#define ll long long
#define int long long
#define pb push_back
#define fi first
#define se second
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
#define ld long double
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii, int> ipii;
const int MAXN = 1e6+10;
const ll INF = 1e18+10;
const int LOG = 29;
const int MOD = 1e9+7;
const int SQRT = 450;
const vector<int> NOL = {};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const vector<int> dx = {1, -1, 0, 0};
const vector<int> dy = {0, 0, 1, -1};

int n, m, q;
int a[MAXN];


signed main(){
	// ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin >> n >> m;
	for(int i=1; i<=n; i++) cin >> a[i];
	
	for(int xx=1; xx<=m; xx++){
		int l, r, x; cin >> l >> r >> x;
		set <int> s;
		int MX = 0;
		for(int i=r; i>=l; i--){
			auto it = s.lower_bound(a[i]);
			if(it != s.begin()){
				it--; MX = max(MX, a[i] + *it);
			}
			s.insert(a[i]);
		}
		if(MX <= x) cout << "1\n";
		else cout << "0\n";
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 9 ms 488 KB Output is correct
7 Correct 9 ms 460 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 9 ms 488 KB Output is correct
7 Correct 9 ms 460 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 175 ms 604 KB Output is correct
12 Correct 581 ms 780 KB Output is correct
13 Correct 692 ms 804 KB Output is correct
14 Correct 1156 ms 856 KB Output is correct
15 Correct 1155 ms 856 KB Output is correct
16 Correct 1548 ms 600 KB Output is correct
17 Correct 1079 ms 604 KB Output is correct
18 Correct 67 ms 556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 3058 ms 47468 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3057 ms 3152 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 9 ms 488 KB Output is correct
7 Correct 9 ms 460 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 175 ms 604 KB Output is correct
12 Correct 581 ms 780 KB Output is correct
13 Correct 692 ms 804 KB Output is correct
14 Correct 1156 ms 856 KB Output is correct
15 Correct 1155 ms 856 KB Output is correct
16 Correct 1548 ms 600 KB Output is correct
17 Correct 1079 ms 604 KB Output is correct
18 Correct 67 ms 556 KB Output is correct
19 Execution timed out 3050 ms 13648 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 9 ms 488 KB Output is correct
7 Correct 9 ms 460 KB Output is correct
8 Correct 11 ms 348 KB Output is correct
9 Correct 5 ms 348 KB Output is correct
10 Correct 2 ms 348 KB Output is correct
11 Correct 175 ms 604 KB Output is correct
12 Correct 581 ms 780 KB Output is correct
13 Correct 692 ms 804 KB Output is correct
14 Correct 1156 ms 856 KB Output is correct
15 Correct 1155 ms 856 KB Output is correct
16 Correct 1548 ms 600 KB Output is correct
17 Correct 1079 ms 604 KB Output is correct
18 Correct 67 ms 556 KB Output is correct
19 Execution timed out 3058 ms 47468 KB Time limit exceeded
20 Halted 0 ms 0 KB -