Submission #260660

# Submission time Handle Problem Language Result Execution time Memory
260660 2020-08-10T16:41:49 Z limabeans Triple Jump (JOI19_jumps) C++17
5 / 100
4000 ms 9088 KB
#include <bits/stdc++.h>
using namespace std;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e6 + 5;


int n, q;
int A[maxn];
vector<pair<int,int>> Q;
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

    cin>>n;
    for (int i=1; i<=n; i++) {
	cin>>A[i];
    }
    
    cin>>q;
    Q.resize(q);
    for (int i=0; i<q; i++) {
	cin>>Q[i].first>>Q[i].second;
    }

    for (auto qu: Q) {
	int l = qu.first;
	int r = qu.second;
	int res = 0;
	for (int a=l; a<=r; a++) {
	    for (int b=a+1; b<=r; b++) {
		for (int c=b+1; c<=r; c++) {
		    if (b-a <= c-b) {
			res = max(res, A[a]+A[b]+A[c]);
		    }
		}
	    }
	}
	cout<<res<<"\n";
    }
    
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 512 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 512 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Execution timed out 4059 ms 9088 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4070 ms 2816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 512 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Execution timed out 4059 ms 9088 KB Time limit exceeded
12 Halted 0 ms 0 KB -