QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#733534 | #5978. Runaway Quail | jamesharden666 | 0 | 2686ms | 5252kb | C++14 | 2.4kb | 2024-11-10 19:44:23 | 2024-11-10 19:44:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=500+10;
const double eps=1e-8;
int t,c,n,a[N],tot1=0,tot2=0;
double f[N][N];
struct node
{
double pos,val;
}a1[N],a2[N];
int read()
{
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
w=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9')
s=s*10+(ch-'0'),ch=getchar();
return s*w;
}
bool cmp1(node a,node b)
{
if(a.val!=b.val)
return a.val>b.val;
else
return a.pos>b.pos;
}
bool cmp2(node a,node b)
{
if(a.val!=b.val)
return a.val<b.val;
else
return a.pos<b.pos;
}
double Pos1(int i,double t)
{
return a1[i].pos+a1[i].val*t;
}
double Pos2(int i,double t)
{
return a2[i].pos+a2[i].val*t;
}
int main()
{
t=read();
for(int T=1;T<=t;++T)
{
c=read(),n=read();
tot1=0,tot2=0;
for(int i=1;i<=n;++i)
a[i]=read();
for(int i=1;i<=n;++i)
{
if(a[i]<0)
a1[++tot1]=(node){1.0*a[i],-1.0*read()};
else
a2[++tot2]=(node){1.0*a[i],1.0*read()};
}
sort(a1+1,a1+tot1+1,cmp1);
sort(a2+1,a2+tot2+1,cmp2);
for(int i=0;i<=tot1;++i)
for(int j=0;j<=tot2;++j)
f[i][j]=1e12;
f[tot1][tot2]=0;
for(int i=tot1;i>=0;--i)
for(int j=tot2;j>=0;--j)
{
double maxn=0;
for(int k=tot1;k>=1;--k)
{
double tim=(-Pos1(k,f[i][j]))/(c+a1[k].val);
maxn=max(maxn,tim*c);
if(k==1&&j==0)
f[k-1][j]=min(f[k-1][j],f[i][j]+maxn/c);
else
f[k-1][j]=min(f[k-1][j],f[i][j]+2.0*maxn/c);
}
maxn=0;
for(int k=tot2;k>=1;--k)
{
double tim=Pos2(k,f[i][j])/(c-a2[k].val);
maxn=max(maxn,tim*c);
if(k==1&&i==0)
f[i][k-1]=min(f[i][k-1],f[i][j]+maxn/c);
else
f[i][k-1]=min(f[i][k-1],f[i][j]+2*maxn/c);
}
}
printf("Case #%d: %.8lf\n",T,f[0][0]);
}
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3912kb
input:
50 4 3 -3 -6 -9 3 2 1 2 2 1 -1 1 1 1000 25 769234 -5735820 -524288 -5403090 -6429140 1574982 1 -9733628 -1407481 4093041 4117720 -3193501 -9765195 -3069520 1122216 -5799108 131072 -8482066 -256 -8021159 -8958386 -7027036 5370579 -3602534 -6834567 425 102 744 155 339 19 999 19 159 198 51 304 369 601 ...
output:
Case #1: 3.00000000 Case #2: 5.00000000 Case #3: 741808.67955801 Case #4: 429262.39614211 Case #5: 660314.34256927 Case #6: 349923.70668177 Case #7: 1977782.82692308 Case #8: 607220.69042351 Case #9: 5725896.87634409 Case #10: 659483.76100629 Case #11: 788244.49251870 Case #12: 610881.70515971 Case ...
result:
wrong answer read 741808.679558009957 but expected 51133.937500000000 (test case 3)
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 2686ms
memory: 5252kb
input:
50 4 3 -3 -6 -9 3 2 1 2 2 1 -1 1 1 1000 500 -9650379 9806301 -6495789 -1283284 5022779 4725553 9364178 -8123302 -9609729 7847458 -142364 6983908 8147008 -3186924 7339254 -8737645 8757174 7887319 3609962 5780915 -1752801 -1657946 -9511339 5113995 -7887160 -6093170 260267 -3837106 -356098 6676924 6210...
output:
Case #1: 3.00000000 Case #2: 5.00000000 Case #3: 205911250.08888891 Case #4: 506094.21145975 Case #5: 1398920.34798995 Case #6: 13741948.50000000 Case #7: 1628134.21962617 Case #8: 1169004.11787072 Case #9: 657828.85069009 Case #10: 8069407.98709677 Case #11: 657828.85069009 Case #12: 901472.0734406...
result:
wrong answer read 506094.211459750019 but expected 36298.000000000000 (test case 4)