Submission #204661

# Submission time Handle Problem Language Result Execution time Memory
204661 2020-02-26T13:30:37 Z tduong0806 Triple Jump (JOI19_jumps) C++14
0 / 100
49 ms 3704 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,50)) forinc(j,i+1,min(n,50)) forinc(k,j+1,min(n,50))
    {
        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";
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 49 ms 3576 KB Output is correct
2 Correct 32 ms 3576 KB Output is correct
3 Correct 32 ms 3704 KB Output is correct
4 Correct 48 ms 3704 KB Output is correct
5 Correct 47 ms 3576 KB Output is correct
6 Incorrect 41 ms 3012 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -