Submission #757107

# Submission time Handle Problem Language Result Execution time Memory
757107 2023-06-12T16:22:10 Z jmyszka2007 Triple Jump (JOI19_jumps) C++17
5 / 100
4000 ms 1096 KB
#include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define pi pair<int, int>
#define vi vector<int>
#define pb push_back
constexpr int LIM = 5e5;
int tab[LIM + 10];
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> tab[i];
	}
	int t;
	cin >> t;
	while(t--) {
		int l, r;
		cin >> l >> r;
		int ans = 0;
		for(int i = l; i <= r - 2; i++) {
			for(int j = i + 1; j <= r - 1; j++) {
				for(int k = j + 1; k <= r; k++) {
					if(j - i <= k - j) {
						ans = max(ans, tab[i] + tab[j] + tab[k]);
					}
				}
			}
		}
		cout << ans << '\n';
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 328 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 4 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 328 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 328 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 4 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 328 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 4027 ms 468 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4046 ms 1096 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 3 ms 328 KB Output is correct
4 Correct 3 ms 212 KB Output is correct
5 Correct 3 ms 212 KB Output is correct
6 Correct 3 ms 328 KB Output is correct
7 Correct 4 ms 212 KB Output is correct
8 Correct 3 ms 212 KB Output is correct
9 Correct 4 ms 328 KB Output is correct
10 Correct 3 ms 212 KB Output is correct
11 Execution timed out 4027 ms 468 KB Time limit exceeded
12 Halted 0 ms 0 KB -