Submission #1096277

# Submission time Handle Problem Language Result Execution time Memory
1096277 2024-10-04T07:46:50 Z trinhvtuan Triple Jump (JOI19_jumps) C++17
5 / 100
4000 ms 3664 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define ll long long
#define li pair<ll,int>
#define i2 pair<int,int>
using namespace std;
int n,q;
ll a[500003],mx[500003];
void sub1(){
    for (int i=1;i<=q;i++){
        int l,r;
        cin>>l>>r;
        ll kq=0;
        for (int j=l;j<=r;j++){
            for (int k=j+1;k<=r;k++){
                for (int l=k+1;l<=r;l++){
                    if (k-j<=l-k) kq=max(kq,a[j]+a[k]+a[l]);
                }
            }
        }
        cout<<kq<<"\n";
    }
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("CHONQUA.inp","r",stdin);
    //freopen("CHONQUA.out","w",stdout);
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i];
    cin>>q;
    sub1();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 464 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 2 ms 480 KB Output is correct
7 Correct 3 ms 472 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 464 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 2 ms 480 KB Output is correct
7 Correct 3 ms 472 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Execution timed out 4070 ms 604 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4040 ms 3664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 464 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 3 ms 348 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 2 ms 480 KB Output is correct
7 Correct 3 ms 472 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Execution timed out 4070 ms 604 KB Time limit exceeded
12 Halted 0 ms 0 KB -