编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#20438 #1030. 1-03E. JM的星系战争 Accepted 100 760 ms 2536 K C++ / 1.2 K q3540555 2019-07-22 15:17:44
显示原始代码
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define spause() system("pause")
//#define scanf scanf_s

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;
typedef pair<int, int> prdd;

const llong inf = 0x7fffffffffffffff;

const double mrg = 1e9, efs = 1e-5;

int n, m;
vector<prdd> balls;

void search(double str, double end);
bool check(double f);

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) {
        int t1, t2;
        scanf("%d%d", &t1, &t2);
        balls.push_back(prdd(t1, t2));
    }

    search(0, mrg);

    // spause();
    return 0;
}

void search(double str, double end) {
    if (end - str <= efs) {
        if (check(end))
            printf("%lf", end);
        else
            printf("-1");
        return;
    }
    double mid = (str + end) / 2;
    if (check(mid))
        search(str, mid);
    else
        search(mid, end);
}

bool check(double f) {
    double tf = f;
    for (int i = 0; i < n; i++) {
        tf -= (m + tf) / balls.at(i).second;
        tf -= (m + tf) / balls.at((i + 1) % n).first;
        if (tf < 0)
            return false;
    }
    return true;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:4 ms
内存:308 KiB

输入文件(1.in

2 2
3 4
5 6

答案文件(1.out

4.000000

用户输出

4.000000

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:5 ms
内存:276 KiB

输入文件(2.in

3 1
1 2
4 5
1 3

答案文件(2.out

-1

用户输出

-1

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:5 ms
内存:360 KiB

输入文件(3.in

6 2
4 2
6 6
3 3
3 6
5 5
6 3

答案文件(3.out

85.480000

用户输出

85.480004

Special Judge 信息

OK Error:0.00000399999999999706

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:5 ms
内存:280 KiB

输入文件(4.in

4 4
2 2
3 3
2 4
2 3

答案文件(4.out

284.000000

用户输出

284.000002

Special Judge 信息

OK Error:0.00000200000000000200

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:4 ms
内存:272 KiB

输入文件(5.in

2 1000
12 34
56 78

答案文件(5.out

159.265078

用户输出

159.265078

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0
测试点 #6
Accepted
得分:100
用时:4 ms
内存:304 KiB

输入文件(6.in

106 947
647 4
940 883
12 867
102 282
424 472
79 85
762 99
579 583
235 196
263 484
350 69
<835 bytes omitted>

答案文件(6.out

2982.034480

用户输出

2982.034481

Special Judge 信息

OK Error:0.00000099999999991773

系统信息

Exited with return code 0
测试点 #7
Accepted
得分:100
用时:5 ms
内存:280 KiB

输入文件(7.in

520 396
825 67
386 870
498 473
433 81
718 722
183 477
672 826
874 485
468 632
520 833
975
<4474 bytes omitted>

答案文件(7.out

1542017.250923

用户输出

1542017.250927

Special Judge 信息

OK Error:0.00000400000010358781

系统信息

Exited with return code 0
测试点 #8
Accepted
得分:100
用时:5 ms
内存:312 KiB

输入文件(8.in

738 169
131 889
340 59
49 946
219 427
861 675
96 195
228 622
215 667
955 476
95 51
810 19
<6391 bytes omitted>

答案文件(8.out

4527411.268690

用户输出

4527411.268690

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0
测试点 #9
Accepted
得分:100
用时:5 ms
内存:300 KiB

输入文件(9.in

987 682
60 423
401 779
677 116
319 821
919 588
740 251
358 231
274 312
623 796
378 933
18
<8586 bytes omitted>

答案文件(9.out

-1

用户输出

-1

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:5 ms
内存:400 KiB

输入文件(10.in

473 199
406 734
712 238
564 108
117 841
598 16
48 900
725 705
247 258
929 538
90 627
804 
<4052 bytes omitted>

答案文件(10.out

-1

用户输出

-1

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0
测试点 #11
Accepted
得分:100
用时:51 ms
内存:892 KiB

输入文件(11.in

59750 2281
93567 44021
47430 98340
9559 55192
27106 80521
22955 42810
48320 85590
81770 90294
<763196 bytes omitted>

答案文件(11.out

745083116.771248

用户输出

745083116.771262

Special Judge 信息

OK Error:0.00001400004839524627

系统信息

Exited with return code 0
测试点 #12
Accepted
得分:100
用时:165 ms
内存:2512 KiB

输入文件(12.in

200000 364
4699406 7476559
3074519 9220641
9953397 4609875
5011840 8555716
9299532 7782002
680
<3363507 bytes omitted>

答案文件(12.out

74.385041

用户输出

74.385042

Special Judge 信息

OK Error:0.00000100000000000100

系统信息

Exited with return code 0
测试点 #13
Accepted
得分:100
用时:23 ms
内存:664 KiB

输入文件(13.in

23821 7264
75949 33096
91115 42348
81152 81964
27272 91134
28847 96689
86108 29747
30204 5578
<304247 bytes omitted>

答案文件(13.out

769628.161872

用户输出

769628.161876

Special Judge 信息

OK Error:0.00000399999998990097

系统信息

Exited with return code 0
测试点 #14
Accepted
得分:100
用时:32 ms
内存:916 KiB

输入文件(14.in

35768 2145
55319 25036
49408 9299
49217 39951
90958 77142
44396 13466
8576 98650
36023 62002
<456877 bytes omitted>

答案文件(14.out

5955028.974811

用户输出

5955028.974817

Special Judge 信息

OK Error:0.00000599999975747778

系统信息

Exited with return code 0
测试点 #15
Accepted
得分:100
用时:57 ms
内存:1456 KiB

输入文件(15.in

66177 13
14609 92016
32279 95577
60901 20717
1545 39312
82239 94186
55303 88326
52979 70206

<845575 bytes omitted>

答案文件(15.out

29613563.761636

用户输出

29613563.761643

Special Judge 信息

OK Error:0.00000700000055076089

系统信息

Exited with return code 0
测试点 #16
Accepted
得分:100
用时:174 ms
内存:2448 KiB

输入文件(16.in

200000 182730
51203472 887121657
889997928 717080718
101945687 541029100
340190334 398852700
41
<4155289 bytes omitted>

答案文件(16.out

1033.627692

用户输出

1033.627697

Special Judge 信息

OK Error:0.00000499999999992173

系统信息

Exited with return code 0
测试点 #17
Accepted
得分:100
用时:167 ms
内存:2536 KiB

输入文件(17.in

200000 795860
187377578 44646426
558344784 913526041
339835037 509114477
549140685 797619990
22
<4155454 bytes omitted>

答案文件(17.out

5247.484968

用户输出

5247.484971

Special Judge 信息

OK Error:0.00000299999999997524

系统信息

Exited with return code 0
测试点 #18
Accepted
得分:100
用时:44 ms
内存:2476 KiB

输入文件(18.in

200000 235586
943405140 283599333
364806089 660747155
295789446 531301075
516663047 447824292
2
<4155162 bytes omitted>

答案文件(18.out

-1

用户输出

-1

Special Judge 信息

OK Error:0.00000000000000000000

系统信息

Exited with return code 0