QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#180329#3448. TomosynthesisrootcucuWA 7ms5288kbC++171.3kb2023-09-15 18:17:162023-09-15 18:17:18

Judging History

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

  • [2023-09-15 18:17:18]
  • 评测
  • 测评结果:WA
  • 用时:7ms
  • 内存:5288kb
  • [2023-09-15 18:17:16]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const long double PI = acos(-1);
struct cyl {
    long double cx;
    long double cy;
    long double radii;
};

vector<pair<long double,long double>> vec_dup;
void f(cyl cyl1, cyl cyl2){
    auto [cx1,cy1,r1] = cyl1;
    auto [cx2,cy2,r2] = cyl2;
    long double rad_centers = atan2(cy2-cy1,cx2-cx1);
    long double rad_tan = asin((r1+r2)/hypot(cy2-cy1,cx2-cx1));
    long double rad1 = rad_centers - rad_tan - 2*PI;
    for (int i = 0; i < 8; i++){
        vec_dup.push_back({rad1,rad1 + 2*rad_tan});
        rad1 += PI;
    }
}

int main(void){
    ios::sync_with_stdio(0); cin.tie(0);
    cout << fixed;
    cout.precision(12);

    int n; cin >> n;
    vector<cyl> vec(n);
    for (auto &[cx,cy,radii]: vec)
        cin >> cx >> cy >> radii;

    for (int i = 0; i < n; i++){
        for (int j = i+1; j < n; j++){
            f(vec[i], vec[j]);
        }
    }

    long double ans = -1;
    sort(vec_dup.begin(), vec_dup.end());
    long double dup = PI;
    for (auto [rad1,rad2] : vec_dup){
        if (rad1 > dup){
            ans = max(ans, rad1 - dup);
        }
        dup = max(dup, rad2);
    }
    if (ans < 0)
        cout << "0\n";
    else
        cout << ans << "\n";
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3948kb

input:

3
-1 -1 0.5
1 -1 0.25
1 1 1

output:

0.511268019362

result:

ok found '0.511268019', expected '0.511268019', error '0.000000000'

Test #2:

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

input:

2
0 0 1
2 2 1

output:

1.570796326795

result:

ok found '1.570796327', expected '1.570796327', error '0.000000000'

Test #3:

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

input:

3
-1.00000000 -1.00000000 0.99999900
1.00000000 -1.00000000 0.99999900
0.00000000 1.00000000 0.10000000

output:

0

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #4:

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

input:

3
-1.00000000 -1.00000000 0.00000100
1.00000000 -1.00000000 0.00000100
0.00000000 1.00000000 0.00000100

output:

1.107146823367

result:

ok found '1.107146823', expected '1.107146823', error '0.000000000'

Test #5:

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

input:

2
-1.00000000 0.00000000 0.70710678
1.00000000 0.00000000 0.70710678

output:

1.570796330151

result:

ok found '1.570796330', expected '1.570796330', error '0.000000000'

Test #6:

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

input:

2
0.00000000 0.00000000 0.50000000
1.00000000 1.00000000 0.50000000

output:

1.570796326795

result:

ok found '1.570796327', expected '1.570796327', error '0.000000000'

Test #7:

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

input:

2
0.00000000 0.00000000 0.50000000
-10.00000000 10.00000000 0.50000000

output:

3.000053180265

result:

ok found '3.000053180', expected '3.000053180', error '0.000000000'

Test #8:

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

input:

2
0.00000000 0.00000000 0.50000000
10.50000000 -10.50000000 0.50000000

output:

3.006803635086

result:

ok found '3.006803635', expected '3.006803635', error '0.000000000'

Test #9:

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

input:

2
0.00000000 0.00000000 0.50000000
-999.99000000 -999.99000000 0.50000000

output:

3.140178425767

result:

ok found '3.140178426', expected '3.140178426', error '0.000000000'

Test #10:

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

input:

2
-1000.00000000 0.00000000 0.00100000
1000.00000000 0.00000000 0.00100000

output:

3.141590653590

result:

ok found '3.141590654', expected '3.141590654', error '0.000000000'

Test #11:

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

input:

3
1000.00000000 0.00000000 1000.00000000
-0.10000000 0.00000000 0.00100000
0.00000000 2.00000000 0.00100000

output:

0.002828421704

result:

ok found '0.002828422', expected '0.002828422', error '0.000000000'

Test #12:

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

input:

3
1000.00000000 0.00000000 1000.00000000
-0.10000000 0.00000000 0.00100000
1.00000000 50.00000000 0.00100000

output:

0

result:

ok found '0.000000000', expected '0.000000000', error '-0.000000000'

Test #13:

score: 0
Accepted
time: 7ms
memory: 5288kb

input:

100
0.00000000 0.00000000 1.00000000
10.00000000 0.00000000 1.00000000
20.00000000 0.00000000 1.00000000
30.00000000 0.00000000 1.00000000
40.00000000 0.00000000 1.00000000
50.00000000 0.00000000 1.00000000
60.00000000 0.00000000 1.00000000
70.00000000 0.00000000 1.00000000
80.00000000 0.00000000 1....

output:

2.318558961455

result:

ok found '2.318558961', expected '2.318558961', error '0.000000000'

Test #14:

score: -100
Wrong Answer
time: 0ms
memory: 3924kb

input:

5
-731.27151178 -101.01787042 1.23400000
694.86747387 303.18594545 1.23400000
527.54923795 577.44670227 1.23400000
-489.86194852 -812.28082645 1.23400000
-9.12982582 -943.30504696 1.23400000

output:

1.614845146038

result:

wrong answer 1st numbers differ - expected: '0.6616525', found: '1.6148451', error = '0.9531926'