Submission #807397

#TimeUsernameProblemLanguageResultExecution timeMemory
807397oscar1fTriple Jump (JOI19_jumps)C++17
5 / 100
4045 ms1868 KiB
#include<bits/stdc++.h> using namespace std; #define int long long const int MAX_VAL=500*1000+5; int nbVal,nbReq,debReq,finReq,rep; int val[MAX_VAL]; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin>>nbVal; for (int i=1;i<=nbVal;i++) { cin>>val[i]; } cin>>nbReq; for (int j=1;j<=nbReq;j++) { cin>>debReq>>finReq; rep=0; for (int a=debReq;a<=finReq;a++) { for (int b=a+1;b<=finReq;b++) { for (int c=b+1;c<=finReq;c++) { if(b-a<=c-b) { rep=max(rep,val[a]+val[b]+val[c]); } } } } cout<<rep<<endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...