QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#375785 | #4682. Pipe Stream | InfinityNS | WA | 13ms | 3892kb | C++14 | 1.1kb | 2024-04-03 15:51:14 | 2024-04-03 15:51:15 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
using namespace std;
int l,s,t;
ld factor;
int solve(int v1, int v2, int knock){
if(v2-v1<=t)return knock;
int slt=(knock+1)*s;
int pos=(int)((v2-v1)*factor+v1);
pos=min(pos,v2-t);
ll val=(ll)pos*(knock+1)*s;
if(val>l)return -1;
int r=solve(pos,v2,knock+1);
if(r==-1)return -1;
int l=solve(v1,pos,knock+1);
if(l==-1)return -1;
return max(l,r);
}
int main(){
int o;
scanf("%i",&o);
while(o--){
int v1,v2;
scanf("%i %i %i %i %i",&l,&v1,&v2,&t,&s);
ld l=0.5,r=1;
int ans=-1;
for(int i=0;i<100;i++){
ld m=(l+r)/2;
factor=m;
int x=solve(v1,v2,0);
if(x!=-1){
r=m;
ans=x;
}
else{
l=m;
}
}
if(ans==-1){
printf("impossible\n");
}
else{
printf("%i\n",ans);
}
}
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3892kb
input:
3 1000 1 30 1 1 60 2 10 2 5 59 2 10 2 5
output:
5 3 impossible
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 13ms
memory: 3852kb
input:
100 1 1 2 1 1 1 1 3 1 1 2 1 3 1 1 3 1 4 1 1 4 1 4 1 1 100000 1 1000000 1 1 100000 1 9 1 1 100000 1 9454 1 1 100000 1 9455 1 1 500832 1 40181 1 1 500832 1 40182 1 1 524288 1 41871 1 1 524288 1 41872 1 1 930168 1 70677 1 1 930168 1 70678 1 1 930169 1 70677 1 1 930169 1 70678 1 1 930170 1 70677 1 1 930...
output:
0 impossible 1 impossible 2 impossible 3 impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible impossible 3 3 6 impossible 0 0 impossible impossible impossible impossible 2 2 imp...
result:
wrong answer 8th lines differ - expected: '24', found: 'impossible'