이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
typedef long long ll;
 
#define fi first 
#define se second 
#define pll pair<ll,ll>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl;
#define MP make_pair
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define SZ(x) (ll)x.size()
#define ALL(x) x.begin(),x.end()
#define endl "\n"
const ll inf=1e18;
ll lowbit(ll x){return x&(-x);}
const ll maxn=1111;
ll a[maxn];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll n;cin>>n;
	rep(i,1,n+1)cin>>a[i];
	ll q;cin>>q;
	while(q--){
		ll l,r;cin>>l>>r;
		ll mx=0;
		rep(i,l,r+1){
			rep(j,i+1,r+1){
				rep(k,j+1,r+1){
					if(k-j<j-i)continue;
					mx=max(mx,a[i]+a[j]+a[k]);
				}
			}
		}
		cout<<mx<<endl;
	}
	return 0;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |