QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#576689#8183. Circle UnionAfterlifeAC ✓61ms4364kbC++17994b2024-09-19 21:35:172024-09-19 21:35:22

Judging History

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

  • [2024-09-19 21:35:22]
  • 评测
  • 测评结果:AC
  • 用时:61ms
  • 内存:4364kb
  • [2024-09-19 21:35:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

#define double long double

const int N=1e4+1e3+7;

const double pi=acos(-1);

int n,R[N];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>R[i];
    double l=0,r=2e3;
    for(int T=1;T<=100;T++)
    {
        double m=(l+r)/2;
        double s=0;
        for(int i=1;i<=n;i++)
        {
            double z=m/2;
            double cs=z/R[i];
            if(cs>1)
                continue;
            s+=acos(cs)*2;
        }
        if(s>pi*2)
            l=m;
        else
            r=m;
    }
    double ans=0;
    for(int i=1;i<=n;i++)
    {
        double z=l/2;
        double cs=z/R[i];
        if(cs>1)
            continue;
        double ang=acos(cs);
        ang=pi/2-ang;
        ang*=2;
        ans+=pi*R[i]*R[i];
        ans-=(ang*R[i]*R[i]-sin(ang)*R[i]*R[i]);
    }
    cout<<fixed<<setprecision(12)<<ans<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
10 9 8

output:

726.457831146837

result:

ok found '726.4578311', expected '726.4578311', error '0.0000000'

Test #2:

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

input:

4
9 8 10 1

output:

726.457831146837

result:

ok found '726.4578311', expected '726.4578311', error '0.0000000'

Test #3:

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

input:

5
933 945 965 75 100

output:

7977861.393377583126

result:

ok found '7977861.3933776', expected '7977861.3933776', error '0.0000000'

Test #4:

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

input:

10000
973 927 32 9 32 56 31 53 16 86 57 100 48 67 36 8 46 18 52 42 38 46 5 3 77 80 14 9 61 49 27 40 11 73 84 2 49 52 36 18 56 53 51 50 35 47 75 17 62 94 39 78 80 28 52 59 29 37 47 99 65 97 25 85 43 86 38 78 67 12 65 46 28 23 38 72 91 25 40 50 34 97 19 54 90 29 28 59 86 73 28 65 18 25 29 29 8 27 48 2...

output:

5679522.122217681115

result:

ok found '5679522.1222177', expected '5679522.1222177', error '0.0000000'

Test #5:

score: 0
Accepted
time: 2ms
memory: 4224kb

input:

10000
982 950 975 82 16 40 91 35 60 25 55 29 71 84 50 59 64 71 1 28 48 25 58 11 2 41 27 79 79 15 30 72 23 81 14 69 86 59 36 33 45 7 39 34 50 91 93 88 79 42 28 11 72 58 43 84 84 49 50 12 4 79 56 42 32 10 29 12 24 98 84 58 4 58 94 55 44 33 91 2 69 21 54 22 62 80 78 82 20 89 31 30 35 24 37 76 50 51 29 ...

output:

8341162.635919156797

result:

ok found '8341162.6359192', expected '8341162.6359192', error '0.0000000'

Test #6:

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

input:

5
931 318 807 757 670

output:

6599431.279720876740

result:

ok found '6599431.2797209', expected '6599431.2797209', error '0.0000000'

Test #7:

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

input:

10
686 379 153 252 725 637 829 57 192 558

output:

5447692.063200941186

result:

ok found '5447692.0632009', expected '5447692.0632009', error '0.0000000'

Test #8:

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

input:

100
525 416 12 588 53 385 141 820 687 372 827 984 450 493 759 781 504 133 813 143 866 392 593 906 634 101 197 370 671 89 132 28 925 92 259 563 746 922 474 92 194 851 879 218 109 163 435 554 4 99 515 720 447 974 64 985 993 613 223 327 698 460 554 368 84 602 902 863 399 285 331 434 446 548 607 90 448 ...

output:

11107561.988629924597

result:

ok found '11107561.9886299', expected '11107561.9886299', error '0.0000000'

Test #9:

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

input:

1000
764 820 270 614 343 685 881 527 503 66 827 188 725 48 313 163 776 974 739 60 108 175 957 143 566 460 433 365 697 640 131 115 611 234 419 130 88 6 695 785 406 36 910 881 72 640 582 784 844 896 62 799 557 145 453 836 209 811 610 497 267 432 825 259 370 809 948 683 777 705 96 433 981 904 828 276 2...

output:

12242634.078853231775

result:

ok found '12242634.0788532', expected '12242634.0788532', error '0.0000000'

Test #10:

score: 0
Accepted
time: 3ms
memory: 4096kb

input:

10000
992 382 902 942 283 996 644 238 613 859 114 208 719 976 529 293 892 781 191 199 390 639 815 422 855 110 38 100 513 208 215 826 87 453 408 225 273 188 139 914 540 29 294 151 208 94 435 647 192 271 353 246 558 893 985 746 364 850 513 311 531 403 805 660 48 625 377 196 234 809 24 198 534 948 440 ...

output:

12509254.341796010020

result:

ok found '12509254.3417960', expected '12509254.3417960', error '0.0000000'

Test #11:

score: 0
Accepted
time: 5ms
memory: 4300kb

input:

10000
902 930 918 955 900 947 944 944 922 957 999 961 907 996 906 926 904 973 959 939 934 914 962 966 993 923 904 942 986 922 985 921 911 974 926 931 984 978 924 990 979 962 954 994 970 971 954 981 974 985 933 1000 965 943 927 953 942 950 954 967 984 964 978 902 900 967 993 965 973 924 943 973 925 9...

output:

12561487.336729327229

result:

ok found '12561487.3367293', expected '12561487.3367293', error '0.0000000'

Test #12:

score: 0
Accepted
time: 33ms
memory: 4364kb

input:

10000
2 2 2 2 2 1 2 2 2 2 1 1 1 1 1 1 1 2 2 2 1 2 2 1 2 1 1 1 2 1 2 1 2 2 2 2 1 2 1 1 2 1 1 2 2 2 1 1 2 2 2 1 1 2 1 2 2 2 1 1 1 2 1 2 1 1 2 2 1 2 1 2 2 1 2 2 1 1 2 1 2 1 1 1 1 2 2 2 1 1 2 1 1 2 2 1 1 1 1 1 2 2 1 1 1 2 1 1 1 1 2 2 2 2 2 1 1 2 2 2 2 1 2 2 1 1 2 2 2 1 1 1 2 2 1 1 1 1 1 2 2 1 1 1 1 2 2 ...

output:

50.265475916235

result:

ok found '50.2654759', expected '50.2654759', error '0.0000000'

Test #13:

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

input:

1
975

output:

2986476.516318797081

result:

ok found '2986476.5163188', expected '2986476.5163188', error '0.0000000'

Test #14:

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

input:

1
1000

output:

3141592.653589793116

result:

ok found '3141592.6535898', expected '3141592.6535898', error '0.0000000'

Test #15:

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

input:

1
1

output:

3.141592653590

result:

ok found '3.1415927', expected '3.1415927', error '0.0000000'

Test #16:

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

input:

2
432 502

output:

1377990.502458783775

result:

ok found '1377990.5024588', expected '1377990.5024588', error '0.0000000'

Test #17:

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

input:

2
182 63

output:

116531.096299606196

result:

ok found '116531.0962996', expected '116531.0962996', error '0.0000000'

Test #18:

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

input:

2
1000 1

output:

3141595.795182446706

result:

ok found '3141595.7951824', expected '3141595.7951824', error '0.0000000'

Test #19:

score: 0
Accepted
time: 54ms
memory: 4168kb

input:

10000
999 974 956 951 924 899 881 877 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 867 86...

output:

10535946.435610523688

result:

ok found '10535946.4356105', expected '10535946.4355938', error '0.0000000'

Test #20:

score: 0
Accepted
time: 3ms
memory: 4092kb

input:

10000
987 950 937 189 249 424 291 394 28 64 19 17 126 403 364 246 167 116 63 14 211 323 381 42 334 347 474 291 211 193 147 425 116 427 340 116 197 450 436 223 272 359 55 134 139 420 371 201 176 177 447 268 55 309 79 410 118 89 406 325 236 200 302 39 154 384 357 309 130 130 105 31 446 94 362 83 225 2...

output:

8155657.092275664111

result:

ok found '8155657.0922757', expected '8155657.0922757', error '0.0000000'

Test #21:

score: 0
Accepted
time: 38ms
memory: 4224kb

input:

9052
737 737 737 737 737 737 737 580 737 737 737 737 737 737 737 430 737 225 602 737 275 737 737 291 737 656 737 737 737 234 737 737 737 737 737 737 601 737 737 737 409 737 737 565 737 737 737 737 737 737 518 737 737 737 592 505 737 737 320 737 737 737 737 737 737 737 737 79 561 737 737 737 737 737 ...

output:

8509359.409606291132

result:

ok found '8509359.4096063', expected '8509359.4096214', error '0.0000000'

Test #22:

score: 0
Accepted
time: 37ms
memory: 4160kb

input:

9297
815 815 272 815 815 658 815 216 58 815 168 815 809 815 506 1 215 363 661 815 815 815 815 815 815 815 360 815 815 815 815 815 628 304 477 806 815 550 318 497 815 815 325 815 815 815 314 815 815 815 615 815 815 815 815 815 392 229 569 815 815 563 228 815 815 743 46 815 815 19 815 312 815 735 474 ...

output:

9311952.105720787707

result:

ok found '9311952.1057208', expected '9311952.1057264', error '0.0000000'

Test #23:

score: 0
Accepted
time: 5ms
memory: 4272kb

input:

2195
35 52 794 794 342 633 794 794 247 432 436 794 794 476 268 188 42 237 528 401 170 193 630 691 348 598 37 794 794 577 623 486 570 589 794 635 264 687 390 794 794 794 291 900 580 103 772 223 794 548 794 122 130 734 756 523 761 554 794 794 794 731 523 313 66 644 770 794 63 466 794 472 60 89 794 685...

output:

9231863.592377657007

result:

ok found '9231863.5923777', expected '9231863.5923775', error '0.0000000'

Test #24:

score: 0
Accepted
time: 30ms
memory: 4216kb

input:

7287
807 807 366 741 807 807 807 807 807 241 807 782 807 807 807 652 807 807 232 518 164 182 807 807 807 417 807 562 807 807 100 489 191 228 560 807 807 425 807 807 807 384 807 807 499 807 733 807 643 423 807 628 316 664 219 74 807 412 451 807 807 503 807 411 37 701 807 807 460 807 807 807 807 807 8...

output:

9429713.412860211999

result:

ok found '9429713.4128602', expected '9429713.4128603', error '0.0000000'

Test #25:

score: 0
Accepted
time: 3ms
memory: 4304kb

input:

9999
730 454 470 456 523 542 469 148 745 769 595 726 753 665 252 232 538 271 384 666 156 658 486 103 51 70 759 381 535 458 356 1 284 299 461 467 630 311 610 748 477 179 626 651 776 58 21 613 598 256 719 236 150 20 587 712 377 252 648 748 787 735 761 635 422 128 326 487 336 538 299 124 26 514 220 748...

output:

9736820.075522938910

result:

ok found '9736820.0755229', expected '9736820.0755229', error '0.0000000'

Test #26:

score: 0
Accepted
time: 61ms
memory: 4296kb

input:

10000
809 809 809 809 809 809 379 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 809 80...

output:

9405823.411655250384

result:

ok found '9405823.4116553', expected '9405823.4116373', error '0.0000000'

Test #27:

score: 0
Accepted
time: 57ms
memory: 4100kb

input:

10000
815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 815 81...

output:

9786548.068844222862

result:

ok found '9786548.0688442', expected '9786548.0688075', error '0.0000000'

Test #28:

score: 0
Accepted
time: 58ms
memory: 4220kb

input:

10000
887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 887 88...

output:

10574867.749662024509

result:

ok found '10574867.7496620', expected '10574867.7496624', error '0.0000000'

Test #29:

score: 0
Accepted
time: 52ms
memory: 4160kb

input:

10000
823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 823 82...

output:

9680428.032146190037

result:

ok found '9680428.0321462', expected '9680428.0320844', error '0.0000000'