QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#66787#5170. 加速度myee0 3ms1792kbC++141.9kb2022-12-09 11:54:052022-12-09 11:54:05

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:54:05]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:1792kb
  • [2022-12-09 11:54:05]
  • 提交

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;
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;
    dbl t=0,v=0;
    for(uint i=1;i<=n;i++){
        dbl s=S[i]-S[i-1],dt=L[i]-t;if(dt<0)dt=0;
        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);
        t+=dt;
        if(t>R[i])return puts("kaibai"),0;
    }
    printf("%lf\n",t);
    return 0;
}
// 那就是希望。
// 即便需要取模,也是光明。

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 30
Accepted
time: 0ms
memory: 1632kb

input:

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


output:

6.585786

result:

ok found '6.58579', expected '6.58579', error '0.00000'

Test #2:

score: 0
Accepted
time: 1ms
memory: 1792kb

input:

5 1
0 1 2 3 4 5
0 1000000000
1 2
2 3
3 4
4 5
5 6

output:

5.000000

result:

ok found '5.00000', expected '5.00000', error '0.00000'

Test #3:

score: -30
Wrong Answer
time: 1ms
memory: 1536kb

input:

2 1
0 2 8
0 1000000000
4 1000000000
0 1000000000

output:

5.772002

result:

wrong answer 1st numbers differ - expected: '6.00000', found: '5.77200', error = '0.03800'

Subtask #2:

score: 0
Wrong Answer

Test #7:

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

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: 3ms
memory: 1684kb

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:

416.132712

result:

wrong answer 1st numbers differ - expected: '100.27779', found: '416.13271', error = '3.14980'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%