답안 #889803

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
889803 2023-12-20T07:19:01 Z vjudge1 Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) C++17
17 / 100
3000 ms 262144 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define forik(x) ll i = 1; i <= x; i++

// (a mod 1e9) / (b mod 1e9) = a * (b^1e9)

using namespace std;

ll a, b, c, e, t, n, m, k, p[200001], d[5001][5001];
vector <pair <ll, ll>> g;

//ll gcd (ll a, ll b){
//	while (a > 0 && b > 0){
//		if (a >= b){
//			a %= b;
//		}
//		else{
//			b %= a;
//		}
//	}
//	return a + b;
//}
//
//ll binpow (ll a, ll b){
//	a %= mod;
//	if (b == 0){
//		return 1;
//	}
//	if (b % 2 == 1){
//		return binpow (a, b - 1) % mod * a % mod;
//	}
//	else{
//		ll t = binpow (a, b / 2) % mod;
//		return t * t % mod;
//	}
//}

signed main (){
	//freopen (".in", "r", stdin);
	//freopen (".out", "w", stdout);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	for (int i = 1; i <= n; i++){
		cin >> p[i];
	}
	for (int i = 1; i <= n; i++){
		a = p[i];
		for (int y = i + 1; y <= n; y++){
			d[i][y] = d[i][y - 1];
			a = max (a, p[y]);
			if (a > p[y]){
				d[i][y] = max (d[i][y], a + p[y]);
			}
//			cout << d[i][y] << ' ';
		}	
//		cout << '\n';
	}
	while (m--){
		cin >> a >> b >> c;
		e = 1;
		if (d[a][b] > c){
			e = 0;
		}
		cout << e << '\n';
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2904 KB Output is correct
5 Correct 1 ms 3420 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
7 Correct 2 ms 7004 KB Output is correct
8 Correct 2 ms 7004 KB Output is correct
9 Correct 1 ms 3672 KB Output is correct
10 Correct 2 ms 7004 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2904 KB Output is correct
5 Correct 1 ms 3420 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
7 Correct 2 ms 7004 KB Output is correct
8 Correct 2 ms 7004 KB Output is correct
9 Correct 1 ms 3672 KB Output is correct
10 Correct 2 ms 7004 KB Output is correct
11 Correct 9 ms 22108 KB Output is correct
12 Correct 57 ms 136496 KB Output is correct
13 Correct 50 ms 136276 KB Output is correct
14 Correct 54 ms 143700 KB Output is correct
15 Correct 51 ms 143824 KB Output is correct
16 Correct 48 ms 143756 KB Output is correct
17 Correct 37 ms 107356 KB Output is correct
18 Correct 48 ms 143956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 29 ms 5336 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3140 ms 262144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2904 KB Output is correct
5 Correct 1 ms 3420 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
7 Correct 2 ms 7004 KB Output is correct
8 Correct 2 ms 7004 KB Output is correct
9 Correct 1 ms 3672 KB Output is correct
10 Correct 2 ms 7004 KB Output is correct
11 Correct 9 ms 22108 KB Output is correct
12 Correct 57 ms 136496 KB Output is correct
13 Correct 50 ms 136276 KB Output is correct
14 Correct 54 ms 143700 KB Output is correct
15 Correct 51 ms 143824 KB Output is correct
16 Correct 48 ms 143756 KB Output is correct
17 Correct 37 ms 107356 KB Output is correct
18 Correct 48 ms 143956 KB Output is correct
19 Execution timed out 4059 ms 262144 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2908 KB Output is correct
4 Correct 1 ms 2904 KB Output is correct
5 Correct 1 ms 3420 KB Output is correct
6 Correct 3 ms 7004 KB Output is correct
7 Correct 2 ms 7004 KB Output is correct
8 Correct 2 ms 7004 KB Output is correct
9 Correct 1 ms 3672 KB Output is correct
10 Correct 2 ms 7004 KB Output is correct
11 Correct 9 ms 22108 KB Output is correct
12 Correct 57 ms 136496 KB Output is correct
13 Correct 50 ms 136276 KB Output is correct
14 Correct 54 ms 143700 KB Output is correct
15 Correct 51 ms 143824 KB Output is correct
16 Correct 48 ms 143756 KB Output is correct
17 Correct 37 ms 107356 KB Output is correct
18 Correct 48 ms 143956 KB Output is correct
19 Runtime error 29 ms 5336 KB Execution killed with signal 11
20 Halted 0 ms 0 KB -