QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#180302#3448. TomosynthesisrootcucuWA 0ms4340kbC++171.3kb2023-09-15 17:57:272023-09-15 17:57:27

Judging History

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

  • [2023-09-15 17:57:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4340kb
  • [2023-09-15 17:57:27]
  • 提交

answer

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

vector<pair<double,double>> vec_dup;
void f(cyl cyl1, cyl cyl2){
    auto [cx1,cy1,r1] = cyl1;
    auto [cx2,cy2,r2] = cyl2;
    double rad_centers = atan2(cy2-cy1,cx2-cx1);
    double rad_tan = asin((r1+r2)/hypot(cy2-cy1,cx2-cx1));
    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]);
        }
    }

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


详细

Test #1:

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

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: 4308kb

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: 4276kb

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: 4316kb

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: 4032kb

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: 4276kb

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: 4284kb

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: 4232kb

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: 4312kb

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: 3972kb

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: -100
Wrong Answer
time: 0ms
memory: 4340kb

input:

3
1000.00000000 0.00000000 1000.00000000
-0.10000000 0.00000000 0.00100000
0.00000000 2.00000000 0.00100000

output:

0.048373856735

result:

wrong answer 1st numbers differ - expected: '0.0028284', found: '0.0483739', error = '0.0455454'