Submission #1012994

# Submission time Handle Problem Language Result Execution time Memory
1012994 2024-07-03T04:26:24 Z vjudge1 Triple Jump (JOI19_jumps) C++17
5 / 100
4000 ms 1880 KB
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
#define int long long
const long long inf=1e18+1;
const int MOD=1e9+7;
const int N=5e5+1;
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n; cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int q; cin>>q;
    while(q--){
        int l,r,ans=0; cin>>l>>r; l--; r--;
        for(int i=r;i>=l;i--){
            for(int j=i-1;j>=l;j--){
                for(int k=j-1;k>=j-(i-j) && k>=l;k--){
                    ans=max(ans,a[i]+a[j]+a[k]);
                }
            }
        }
        cout<<ans<<endl;
    }
 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 456 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 1 ms 452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 456 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 1 ms 452 KB Output is correct
11 Execution timed out 4067 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4029 ms 1880 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 456 KB Output is correct
9 Correct 2 ms 348 KB Output is correct
10 Correct 1 ms 452 KB Output is correct
11 Execution timed out 4067 ms 344 KB Time limit exceeded
12 Halted 0 ms 0 KB -