답안 #204662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
204662 2020-02-26T13:31:06 Z tduong0806 3단 점프 (JOI19_jumps) C++14
0 / 100
518 ms 2040 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int hmt() {int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';if(n) x=-x;return x;}
#define in hmt()
#define ins ({string x;char c=getchar();for(;c==' '||c=='\n';c=getchar());for(;c!=' '&&c!='\n';c=getchar()) x+=c;x;})
#define forinc(i,a,b) for(int i=a,_b=b;i<=_b;++i)
#define fordec(i,a,b) for(int i=a;i>=b;--i)
#define forb(i,BS) for(int i=BS._Find_first();i< BS.size();i = BS._Find_next(i))
#define forv(a,b) for(auto &a:b)
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define all(a) a.begin(),a.end()
#define reset(f,x) memset(f,x,sizeof(f))
#define bit(x,i) ((x>>(i-1))&1)
#define onbit(x,i) (x|(1<<(i-1)))
#define offbit(x,i) (x&~(1<<(i-1)))
const int N=500010;
int n,b[4];
pii a[N];
int main()
{
    //freopen("JOI2019.inp","r",stdin);
    n=in;
    forinc(i,1,n) a[i]={in,i};
    sort(a+1,a+n+1);
    reverse(a+1,a+n+1);
    int ans=0;
    forinc(i,1,min(n,500)) forinc(j,i+1,min(n,500)) forinc(k,j+1,min(n,500))
    {
        b[1]=a[i].se,b[2]=a[j].se,b[3]=a[k].se;
        sort(b+1,b+4);
        if(b[2]-b[1]<=b[3]-b[2]) ans=max(ans,a[i].fi+a[j].fi+a[k].fi);
    }
    cout<<ans<<"\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 8 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 8 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 473 ms 2040 KB Output is correct
2 Correct 433 ms 2040 KB Output is correct
3 Correct 217 ms 2040 KB Output is correct
4 Correct 465 ms 1928 KB Output is correct
5 Correct 468 ms 2040 KB Output is correct
6 Incorrect 518 ms 2040 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 8 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -