QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#66802#5170. 加速度myee0 99ms1784kbC++142.1kb2022-12-09 11:59:172022-12-09 11:59:20

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-09 11:59:20]
  • 评测
  • 测评结果:0
  • 用时:99ms
  • 内存:1784kb
  • [2022-12-09 11:59:17]
  • 提交

answer

// 那就是希望。
// 即便需要取模,也是光明。

#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <vector>
typedef long long llt;
typedef unsigned uint;typedef unsigned long long ullt;
typedef bool bol;typedef char chr;typedef void voi;
typedef double dbl;
template<typename T>bol _max(T&a,T b){return(a<b)?a=b,true:false;}
template<typename T>bol _min(T&a,T b){return(b<a)?a=b,true:false;}
template<typename T>T lowbit(T n){return n&-n;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T lcm(T a,T b){return(a!=0||b!=0)?a/gcd(a,b)*b:(T)0;}
template<typename T>T exgcd(T a,T b,T&x,T&y){if(b!=0){T ans=exgcd(b,a%b,y,x);y-=a/b*x;return ans;}else return y=0,x=1,a;}
template<typename T>T power(T base,T index,T mod)
{
    T ans=1%mod;
    while(index)
    {
        if(index&1)ans=ans*base%mod;
        base=base*base%mod,index>>=1;
    }
    return ans;
}
ullt S[5005],L[5005],R[5005],a;
dbl V[5005],T[5005];
int main()
{
#ifdef MYEE
    freopen("QAQ.in","r",stdin);
    // freopen("QAQ.out","w",stdout);
#else
#if !defined(ONLINE_JUDGE)
    freopen("b.in","r",stdin);
    freopen("b.out","w",stdout);
#endif
#endif
    uint n;scanf("%u%llu",&n,&a);
    for(uint i=0;i<=n;i++)scanf("%llu",S+i);
    for(uint i=0;i<=n;i++)scanf("%llu%llu",L+i,R+i);
    for(uint i=1;i<=n;i++)_max(L[i],L[i-1]);
    for(uint i=n;i;i--)_min(R[i-1],R[i]);
    for(uint i=0;i<=n;i++)if(L[i]>R[i])return puts("kaibai"),0;
    for(uint i=1;i<=n;i++){
        T[i]=1e18;
        for(uint l=0;l<i;l++){
            dbl s=S[i]-S[l],dt=L[i]-T[l];if(dt<0)dt=0;
            dbl v=V[l];
            if(dt*v+dt*dt/2*a<s)
                dt=(sqrt(v*v+2*a*s)-v)/a,v+=dt*a;
            else if(a/2*dt*dt<s)
                v=a*dt/2+s/dt;
            else
                v=sqrt(2*a*s);
            dbl t=T[l]+dt;
            _min(T[i],t);_max(V[i],v);
        }
        if(T[i]>R[i])return puts("kaibai"),0;
    }
    printf("%lf\n",T[n]);
    return 0;
}
// 那就是希望。
// 即便需要取模,也是光明。

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 1696kb

input:

4 2
0 2 8 10 12
0 1000000000
2 2
4 4
6 7
6 1000000000


output:

6.000000

result:

wrong answer 1st numbers differ - expected: '6.58579', found: '6.00000', error = '0.08895'

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 20
Accepted
time: 1ms
memory: 1696kb

input:

3 20
0 4632 5697 8786
0 1000000000
1 1000000000
1 1000000000
1 1000000000

output:

29.641188

result:

ok found '29.64119', expected '29.64119', error '0.00000'

Test #8:

score: -20
Wrong Answer
time: 99ms
memory: 1784kb

input:

5000 100
0 26 289 325 425 558 844 885 1020 1186 1385 1398 1414 1444 1470 1914 1932 1956 2127 2194 2316 2339 2419 2521 2567 2647 2655 2804 3016 3053 3102 3240 3294 3491 3540 3591 3642 3680 3763 3804 3865 3955 3997 4048 4053 4100 4212 4222 4238 4302 4354 4358 4532 4534 4547 4550 4551 4695 4761 4762 48...

output:

99.998900

result:

wrong answer 1st numbers differ - expected: '100.27779', found: '99.99890', error = '0.00278'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%