QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#375785#4682. Pipe StreamInfinityNSWA 13ms3892kbC++141.1kb2024-04-03 15:51:142024-04-03 15:51:15

Judging History

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

  • [2024-04-03 15:51:15]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3892kb
  • [2024-04-03 15:51:14]
  • 提交

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'