Submission #1096277

#TimeUsernameProblemLanguageResultExecution timeMemory
1096277trinhvtuanTriple Jump (JOI19_jumps)C++17
5 / 100
4070 ms3664 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...