답안 #505723

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
505723 2022-01-11T07:14:03 Z asakh Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 8972 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define ll long long
#define ull unsigned ll
#define ld long double
#define pb push_back
#define ppb pop_back
#define clr clear
#define len size()
#define beg begin()
#define end end()
#define ins insert
#define f first
#define s second
#define y1 y123456789
#define forn(i, l, r) for(int i = l; i <= r; ++i)
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)

using namespace std;
using namespace __gnu_pbds;

typedef tree < int, null_type, greater_equal < int >, 
				rb_tree_tag, tree_order_statistics_node_update > ordered_set;

int n, m;

const int MAXN = (int)1e6 + 20;

int a[MAXN];

int main()
{
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);

	fastio;

	cin >> n >> m;
	
	for (int i = 1; i <= n; ++i)
		cin >> a[i];
	
	while (m--)
	{
		int l, r, k;
		
		cin >> l >> r >> k;
		
		int mx = a[l], ans = 0;
		
		for (int i = l + 1; i <= r; ++i)
		{
			if (mx > a[i])
				ans = max(ans, a[i] + mx);
			mx = max(mx, a[i]);
		}
		
		cout << (ans <= k) << '\n';
	}

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 324 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 324 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 6 ms 336 KB Output is correct
13 Correct 11 ms 420 KB Output is correct
14 Correct 12 ms 492 KB Output is correct
15 Correct 26 ms 488 KB Output is correct
16 Correct 18 ms 460 KB Output is correct
17 Correct 12 ms 444 KB Output is correct
18 Correct 19 ms 412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3076 ms 8972 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2764 ms 2840 KB Output is correct
2 Execution timed out 3065 ms 1876 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 324 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 6 ms 336 KB Output is correct
13 Correct 11 ms 420 KB Output is correct
14 Correct 12 ms 492 KB Output is correct
15 Correct 26 ms 488 KB Output is correct
16 Correct 18 ms 460 KB Output is correct
17 Correct 12 ms 444 KB Output is correct
18 Correct 19 ms 412 KB Output is correct
19 Execution timed out 3019 ms 4604 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 324 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 216 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 6 ms 336 KB Output is correct
13 Correct 11 ms 420 KB Output is correct
14 Correct 12 ms 492 KB Output is correct
15 Correct 26 ms 488 KB Output is correct
16 Correct 18 ms 460 KB Output is correct
17 Correct 12 ms 444 KB Output is correct
18 Correct 19 ms 412 KB Output is correct
19 Execution timed out 3076 ms 8972 KB Time limit exceeded
20 Halted 0 ms 0 KB -