QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#66709 | #5170. 加速度 | Minion | 0 | 1ms | 1724kb | C++23 | 1.3kb | 2022-12-09 11:08:54 | 2022-12-09 11:08:56 |
Judging History
answer
#include<cstdio>
#include<cmath>
#define fo(i,x,y) for(int i = x;i <= y;++i)
#define fd(i,x,y) for(int i = x;i >= y;--i)
#define _is 1048576
#define gc() ib[++bi]
#define D double
using namespace std;
char ib[_is];int bi = -1;
int rd()
{
int x = 0;char ch = gc();
while(ch < 48 || ch > 57) ch = gc();
while(ch >= 48 && ch <= 57) x = x * 10 + ch - 48,ch = gc();return x;
}
int n,a,s[5010],l[5010],r[5010];
void Mi(int &x,int y) {if(y < x) x = y;}
void Mx(int &x,int y) {if(y > x) x = y;}
int main()
{
fread(ib,1,_is,stdin);
n = rd(),a = rd();
fo(i,0,n) s[i] = rd();
fo(i,0,n) l[i] = rd(),r[i] = rd();
fo(i,2,n) Mx(l[i],l[i - 1]);
fd(i,n - 1,1) Mi(r[i],r[i + 1]);
fo(i,1,n) if(l[i] > r[i]) return puts("kaibai"),0;
D v = 0,c = 0;
fo(i,1,n)
{
D S = s[i] - s[i - 1];
D nv = sqrt(2 * a * S + v * v),t = (nv - v) / a;
if(c + t > r[i]) return puts("kaibai"),0;
else if(c + t >= l[i]) v = nv,c += t;
else
{
D t = l[i] - c,A = min(D(a),2 * S / t / t);
c = l[i],v = S / t + A * t * 0.5;
//0<=v'<=v,0<=a'<=a,max(v'+a't)
//a'<=2S/(t^2)
//max(S/t+a't/2)
}
}
printf("%lf",c);
return 0;
}
詳細信息
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.732051
result:
wrong answer 1st numbers differ - expected: '6.58579', found: '6.73205', error = '0.02221'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 20
Accepted
time: 0ms
memory: 1692kb
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: 1ms
memory: 1724kb
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:
100.477652
result:
wrong answer 1st numbers differ - expected: '100.27779', found: '100.47765', error = '0.00199'
Subtask #3:
score: 0
Skipped
Dependency #1:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%