QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#375833#4682. Pipe StreamInfinityNSAC ✓1ms3924kbC++14691b2024-04-03 16:19:402024-04-03 16:19:41

Judging History

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

  • [2024-04-03 16:19:41]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3924kb
  • [2024-04-03 16:19:40]
  • 提交

answer

#include<bits/stdc++.h>

#define ll long long
#define ld long double
#define pb push_back

using namespace std;

void test(){
    int l,v1,v2,t,s;
    scanf("%i %i %i %i %i",&l,&v1,&v2,&t,&s);
    int n=1;
    for(int k=0;;k++){
        if((ll)n*t>=v2-v1){
            printf("%i\n",k);
            return;
        }
        ll vvmx=l/((ll)s*(k+1));
        int ost=max(0LL,v2-vvmx-t);
        int br=ost/t;
        if(ost%t)br++;
        if(n<=br){
            printf("impossible\n");
            return;
        }
        v2=max(v1,v2-br*t);
        n=(n-br)*2;
    }
}
int main(){
    int o;
    scanf("%i",&o);
    while(o--){
        test();
    }
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3888kb

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: 0
Accepted
time: 0ms
memory: 3896kb

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
24
impossible
45
impossible
32
impossible
46
impossible
46
impossible
46
impossible
45
impossible
45
impossible
impossible
3
3
4
impossible
0
0
impossible
17
15
16
2
2
15
15
14
1
1
0
0
impossible
16
impossible
0
1
2
2
28
29
impossible
29
impossible
0
1
imposs...

result:

ok 100 lines

Test #3:

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

input:

40
1000 1 30 1 1
60 2 10 2 5
59 2 10 2 5
1000000 1 80235 2 1
1000000 1 80236 2 1
1000000 1 80237 2 1
1000000 1 80238 2 1
1000000 1 80239 2 1
1000000 1 80240 2 1
1000000 1 80241 2 1
1000000 1 80242 2 1
1000000 1 80243 2 1
1000000 1 75361 1 1
1000000 1 75362 1 1
1000000 1 75363 1 1
1000000 1 75364 1 1...

output:

5
3
impossible
25
25
25
26
26
26
27
29
impossible
26
26
26
27
27
28
29
impossible
impossible
28
impossible
2
1
impossible
0
0
25
impossible
25
24
24
23
23
22
20
20
impossible
impossible

result:

ok 40 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

100
1000000000 1 45722915 1 1
999999989 1 45722915 1 1
999999983 1 45722915 1 1
999999864 1 45722910 1 1
999995586 1 45722723 1 1
999994891 1 45722693 1 1
999992374 1 45722583 1 1
999949022 1 45720692 1 1
999905219 1 45718781 1 1
999479879 1 45700225 1 1
997558485 1 45616403 1 1
997195352 1 45600561...

output:

46
48
49
53
54
55
58
59
61
64
65
66
67
68
69
70
72
74
impossible
impossible
46
47
59
55
54
56
45
53
48
43
55
44
58
42
55
45
53
49
56
52
49
54
45
43
46
43
55
47
45
50
51
62
43
50
44
46
56
55
42
47
44
53
43
5
9
4
6
11
8
10
7
39
5
23
36
12
40
impossible
impossible
impossible
impossible
impossible
impos...

result:

ok 100 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

100
963597804 8589788 23029396 1 2
904990630 9613515 41508466 1 1
962305849 13680471 44078122 1 1
903367500 7401118 23692652 4 2
929904996 512484 24661207 5 2
986386365 13971769 50830247 7 1
948763065 15891434 43487320 1 1
900962516 529708 43200515 2 1
996841031 2449147 48624000 3 1
979188757 101652...

output:

40
30
36
36
36
36
36
36
41
32
37
37
29
35
29
34
32
42
25
41
41
40
37
45
46
36
26
41
36
37
40
33
39
38
29
29
37
37
38
31
30
31
36
29
35
29
34
29
38
26
34
38
36
31
36
37
41
40
41
29
31
41
30
30
31
44
26
35
29
33
36
36
32
32
36
34
47
44
34
31
38
36
35
37
44
26
31
36
30
31
43
29
35
37
37
36
30
36
43
29

result:

ok 100 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

100
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 1000000000 1 1
1000000000 1 100...

output:

impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
impossible
imp...

result:

ok 100 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

100
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000 1 45722915 1 1
1000000000...

output:

46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46
46

result:

ok 100 lines

Test #8:

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

input:

100
997195352 1 45600561 1 1
995611190 1 45531451 1 1
990196526 1 45295232 1 1
984748288 1 45057548 1 1
983719132 1 45012651 1 1
978427516 1 44781800 1 1
976791672 1 44710435 1 1
976243240 1 44686509 1 1
965941755 1 44237099 1 1
955034506 1 43761262 1 1
952120032 1 43634116 1 1
950463125 1 43561832 ...

output:

66
67
66
66
68
67
67
67
66
66
66
66
69
69
66
66
66
66
67
66
67
66
68
66
68
70
66
72
66
66
68
66
67
66
66
67
66
67
66
68
66
68
66
66
70
68
66
66
66
67
66
66
71
66
66
66
67
71
66
68
68
66
67
66
67
66
66
66
66
69
66
69
66
66
68
67
69
67
66
67
68
66
67
66
67
66
66
66
72
69
68
66
66
66
66
66
66
66
74
66

result:

ok 100 lines

Test #9:

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

input:

100
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 1 1
672406399 1 31431395 ...

output:

74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74

result:

ok 100 lines