QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#408472#5461. Paddle StarsharaelongWA 110ms4208kbC++171.5kb2024-05-10 13:39:312024-05-10 13:39:32

Judging History

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

  • [2024-05-10 13:39:32]
  • 评测
  • 测评结果:WA
  • 用时:110ms
  • 内存:4208kb
  • [2024-05-10 13:39:31]
  • 提交

answer

#include <bits/stdc++.h>
#ifdef SHARAELONG
#include "../../cpp-header/debug.hpp"
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;

const ld PI = 3.14159265358979323846264;
const ld eps = 1e-10;

void solve() {
    ld l1, l2, a, b;
    cin >> l1 >> l2 >> a >> b;
    a *= PI / 180;
    b *= PI / 180;
    
    ld ans = (l1+l2)*(l1+l2)*a + l2*l2*b;
    if (b <= PI/2 + eps) {
        cout << ans << '\n';
        return;
    }

    ld thres = acos(l2/l1);
    if (b < PI - thres - eps) {
        if (2*a < b-PI/2 - eps) {
            ld h = l1 * sin(PI-b);
            ans += l1*l1*cos(PI-b)*sin(PI-b);
            ans -= 2*h*h*a;
            ans -= h*h / tan(PI+2*a-b);
        } else {
            ld h = l1 * sin(PI-b);
            ans += l1*l1*cos(PI-b)*sin(PI-b);
            ans -= h*h*(b-PI/2);
        }
    } else {
        ld l = l1*l1 + l2*l2 - 2*l1*l2*cos(PI-b);
        l = sqrt(l);
        ans += l1*l2*sin(PI-b);
        if (l < eps) {
            cout << ans << '\n';
            return;
        }
        ld g = acos((l1-l2*cos(PI-b)) / l);
        if (2*a < g-eps) {
            ans -= l*l1*sin(g-2*a);
            ans -= 2*l*l*a;
        } else {
            ans -= l*l*g;
        }
    }
    cout << ans << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cout << fixed << setprecision(15);
    
    int cases;
    cin >> cases;
    while (cases--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
2 1 20 20
3 3 0 0
20 20 90 120
20 10 50 170
100 10 1 93

output:

3.490658503988659
0.000000000000000
3367.157611906510746
1098.863278984081835
373.960489570087708

result:

ok 5 numbers

Test #2:

score: -100
Wrong Answer
time: 110ms
memory: 4208kb

input:

100000
88 12 24 116
79 15 84 150
96 52 31 141
100 100 81 29
83 29 71 99
95 92 5 87
99 97 39 72
79 72 20 65
67 39 60 116
100 89 1 62
78 77 63 45
62 34 83 178
92 49 24 103
94 73 66 49
20 14 24 51
100 97 66 109
94 94 86 82
82 79 49 67
76 38 88 118
92 79 58 112
93 23 40 167
87 34 13 25
96 18 73 15
94 38...

output:

4526.991613202875377
13636.479265474324532
19433.170502612669816
61610.122595399831660
17006.233726987326259
15903.667036975089747
37972.639843450068710
13840.111902464634139
14968.804520318270670
9194.795925234086548
31073.492936656643709
16982.120743226402283
12675.930420194697122
36683.2429519542...

result:

wrong answer 31st numbers differ - expected: '12961.4718368', found: '12719.4912958', error = '0.0186692'