QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#106049#5461. Paddle StarjoesmittyAC ✓183ms3712kbC++143.5kb2023-05-16 11:22:132023-05-16 11:22:14

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-16 11:22:14]
  • 评测
  • 测评结果:AC
  • 用时:183ms
  • 内存:3712kb
  • [2023-05-16 11:22:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
 
#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)
#define all(a) a.begin(), a.end()
#define endl '\n';
#define sz(x) (int)(x).size()
 
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
 
template <typename T>
void pr(vector<T> &v) {
    FOR(i, 0, sz(v)) cout << v[i] << " ";
    cout << endl;
}
template <typename T>
void pr(vector<vector<T> > &v) {
    FOR(i, 0, sz(v)) { pr(v[i]); }
}
template <typename T>
void re(T &x) {
    cin >> x;
}
template <typename T>
void re(vector<T> &a) {
    FOR(i, 0, sz(a)) re(a[i]);
}
template <class Arg, class... Args>
void re(Arg &first, Args &... rest) {
    re(first);
    re(rest...);
}
template <typename T>
void pr(T x) {
    cout << x << endl;
}
template <class Arg, class... Args>
void pr(const Arg &first, const Args &... rest) {
    cout << first << " ";
    pr(rest...);
    cout << endl;
}
void ps() { cout << endl; }
template<class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
    cout << t; if (sizeof...(ts)) cout << " "; ps(ts...);
}
 
const ll MOD  =  998244353;
#define inf 1e18;
#define INF INT_MAX;
 
long double PI = 4*atan(1);
long double eps = 1e-12;


ld 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* 0.5) {
        return ans;
    }

    ld d = 0;
    ld phi = 0;

    // perp doesn't reach
    if(l2 <= l1 * cos(PI - b)) {
        d = sqrt(l1 * l1 + l2 * l2 - 2 * l1 * l2 * cos(PI - b));
        phi = asin(l2 / d * sin(PI - b));
    } else {
        phi = b - PI * 0.5;
        d = l1 * cos(phi);
    }

    if(2*a >= phi) {
        ans += l1 * d * sin(phi);
        ans -= d * d * phi;
        return ans;
    } 

    ld d2 = 0;
    ld d3 = 0;

   // cout << d << " " << d2 << " " << d3 << endl;
    // perp doesn't reach
  //  cout << ans << endl;
    if(l2 <= l1 * cos(PI - b)) {
       // cout << "HI" << endl;
        d2 = sin(b-phi)/sin(PI - 2*a - b + phi) * d;
        d3 = sin(b-phi)/sin(PI - b + 2 * a) * d;
    } else {
        d2 = d/cos(2*a);
        d3 = d/cos(phi - 2*a);
    }

    ans += d * d2 * sin(2*a);
    ans -= d * d * 2*a;
    ans += d2 * l1 * sin(phi - 2*a);
    ans -= d * d3 * sin(phi - 2*a);
    return ans;
}

int main() {
    //auto start = chrono::high_resolution_clock::now();
    ios_base::sync_with_stdio(0);cin.tie(0);
    // freopen("promote.in", "r", stdin);
	// freopen("promote.out", "w", stdout);
    #ifdef DEBUG
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif 

    int t; cin >> t;
    FOR(tcase,0,t) {
        cout << setprecision(16) << solve() << endl;
    }
    // cout << 100000 << endl;
    // FOR(i,0,100000) {
    //     cout << "100 10 76 179" << endl;
    // }


    // auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
    // cout << duration.count() << endl;
    //cin.close();
    //cout.close();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3544kb

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
3367.157611906511
1098.863278984082
373.9604895700877

result:

ok 5 numbers

Test #2:

score: 0
Accepted
time: 164ms
memory: 3700kb

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.991613202875
13636.47926547432
19433.17050261267
61610.12259539983
17006.23372698733
15903.66703697509
37972.63984345007
13840.11190246463
14968.80452031827
9194.795925234087
31073.49293665664
16982.1207432264
12675.9304201947
36683.24295195422
658.68725970266
62718.19721575917
65696.5666928492...

result:

ok 100000 numbers

Test #3:

score: 0
Accepted
time: 134ms
memory: 3712kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0
0.0174532925199433
0.03490658503988659
0.05235987755982989
0.06981317007977318
0.08726646259971648
0.1047197551196598
0.1221730476396031
0.1396263401595464
0.1570796326794897
0.174532925199433
0.1919862177193762
0.2094395102393195
0.2268928027592628
0.2443460952792061
0.2617993877991494
0.27925268...

result:

ok 100000 numbers

Test #4:

score: 0
Accepted
time: 141ms
memory: 3648kb

input:

100000
1 1 0 0
1 1 0 1
1 1 0 2
1 1 0 3
1 1 0 4
1 1 0 5
1 1 0 6
1 1 0 7
1 1 0 8
1 1 0 9
1 1 0 10
1 1 0 11
1 1 0 12
1 1 0 13
1 1 0 14
1 1 0 15
1 1 0 16
1 1 0 17
1 1 0 18
1 1 0 19
1 1 0 20
1 1 0 21
1 1 0 22
1 1 0 23
1 1 0 24
1 1 0 25
1 1 0 26
1 1 0 27
1 1 0 28
1 1 0 29
1 1 0 30
1 1 0 31
1 1 0 32
1 1 0 ...

output:

0
0.0174532925199433
0.03490658503988659
0.05235987755982989
0.06981317007977318
0.08726646259971648
0.1047197551196598
0.1221730476396031
0.1396263401595464
0.1570796326794897
0.174532925199433
0.1919862177193762
0.2094395102393195
0.2268928027592628
0.2443460952792061
0.2617993877991494
0.27925268...

result:

ok 100000 numbers

Test #5:

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

input:

1
1 1 0 0

output:

0

result:

ok found '0.0000000', expected '0.0000000', error '-0.0000000'

Test #6:

score: 0
Accepted
time: 144ms
memory: 3540kb

input:

100000
2 1 24 89
3 1 76 68
2 2 52 144
3 3 4 2
2 2 86 44
3 2 87 123
3 2 2 53
3 1 50 172
3 3 86 156
2 2 46 1
3 3 74 71
2 2 20 104
2 2 29 86
3 3 2 30
2 2 26 178
3 2 14 108
3 3 90 69
3 2 13 175
3 3 52 35
2 2 73 31
3 3 77 105
3 1 86 143
3 3 50 109
3 1 13 94
3 2 41 139
2 2 51 154
2 1 57 40
3 3 27 112
2 2 ...

output:

5.323254218582705
22.41002759560719
25.17387662013423
2.827433388230814
27.08750999095199
47.01288606975691
4.572762640225143
17.10152565934856
80.16886424139791
12.91543646475804
57.6482251933727
12.86438463638913
14.10226035611418
5.969026041820607
19.81886567210821
13.73607086102545
67.3871624195...

result:

ok 100000 numbers

Test #7:

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

input:

1
1 1 1 1

output:

0.08726646259971648

result:

ok found '0.0872665', expected '0.0872665', error '0.0000000'

Test #8:

score: 0
Accepted
time: 165ms
memory: 3712kb

input:

100000
71 6 33 34
98 20 79 171
88 16 59 8
45 21 36 79
88 61 44 149
55 47 72 86
81 8 85 122
68 2 35 71
98 91 79 49
73 19 68 148
69 66 81 22
99 94 87 130
65 53 43 53
97 89 84 1
93 88 77 6
83 46 2 51
83 69 46 95
91 55 17 137
93 84 1 54
61 45 74 15
77 65 0 21
84 71 6 32
87 81 37 76
91 55 32 154
73 34 76...

output:

3436.221684618956
20453.89971422096
11173.45824492754
3345.010777909732
27858.12544302741
16389.72378036299
11913.36892082643
2998.196402245939
56334.48095881153
11128.1167240823
27437.5706790245
77419.25917028
13048.23856754229
50858.63260372696
44838.57313457804
2464.369997230953
26444.63609229717...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 166ms
memory: 3504kb

input:

100000
10 1 40 160
6 6 27 16
10 10 7 41
4 1 38 161
7 6 66 143
6 4 26 127
8 4 47 99
4 4 49 121
5 2 68 122
8 8 27 178
10 8 73 125
6 2 20 175
10 1 34 13
7 4 66 102
10 10 14 179
9 7 64 120
7 5 47 169
10 8 68 90
8 2 37 3
5 5 10 164
4 2 26 62
7 5 43 40
1 1 35 103
10 7 71 102
6 1 90 63
6 4 49 44
6 3 84 123...

output:

87.58491335790821
77.91149780902687
120.4277183876087
19.69092398866058
291.6581829250044
83.31848958025333
145.8513632372346
89.2261953793338
67.67199944258124
321.5712287284117
558.4265731545821
34.90393482653037
72.02973822980598
168.0119006371729
411.8275152924305
391.8455078996906
196.280472187...

result:

ok 100000 numbers

Test #10:

score: 0
Accepted
time: 159ms
memory: 3708kb

input:

100000
8 8 89 18
10 1 17 44
6 1 43 5
11 10 84 74
11 11 64 172
10 7 85 51
7 6 71 176
9 7 51 99
5 3 12 54
6 5 26 32
3 2 21 23
10 10 59 151
9 9 81 45
7 4 2 37
11 6 3 172
11 10 65 98
11 10 78 173
7 2 9 104
10 9 46 77
8 3 24 100
11 9 77 41
10 10 55 30
11 6 37 75
9 7 25 56
10 9 14 7
9 9 12 179
11 9 6 130
...

output:

417.7620097573627
36.66936758440086
36.86135380212024
775.6941327563598
917.1929866143248
472.3559087597453
322.4645901227682
312.639212169689
21.88642882000889
68.87069228369624
10.76868148480501
692.8212327321763
521.6614601285851
14.55604596163271
127.7263969813808
671.4494073482595
913.466888314...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 158ms
memory: 3620kb

input:

100000
7 3 55 160
4 3 14 72
9 7 4 52
9 9 31 71
12 1 87 116
9 7 10 154
12 10 20 100
6 5 61 69
12 12 55 130
12 11 7 163
4 3 43 178
11 11 42 155
12 1 20 1
5 3 72 151
7 2 74 136
10 10 66 76
11 11 84 176
8 6 59 110
12 2 54 47
12 12 38 28
12 12 38 105
12 12 60 173
12 4 48 76
2 1 71 31
3 1 21 123
12 7 83 2...

output:

123.8481688417068
23.28269222160436
62.34316088123745
275.6747553525043
258.9925308537615
187.4182443373196
343.7313507611988
158.9296816866036
891.5581093363014
425.5736015514895
65.04740402375243
703.9554219390285
59.00958200992828
107.152855427087
115.7908511815576
593.411945678072
1088.802599177...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 168ms
memory: 3588kb

input:

100000
12 8 12 17
7 1 3 24
13 13 40 16
9 9 77 68
11 1 2 137
8 5 43 153
11 10 60 93
9 4 54 124
13 11 90 62
13 11 23 10
9 5 65 152
13 10 81 159
9 5 0 100
2 1 8 10
13 4 29 108
11 9 33 62
1 1 7 0
7 6 9 117
10 7 79 17
6 3 44 136
9 1 89 169
12 12 90 59
11 11 67 48
8 2 50 165
12 3 36 39
11 2 46 157
12 7 57...

output:

102.7649863574261
3.769911184307752
519.1307327131934
531.557476987393
7.895855251232726
201.6594478137435
624.1355207458364
197.8859939114593
1035.713284718475
252.3397032533402
297.2487707898762
1051.611431187917
43.63323129985824
1.43116998663535
178.0801014881595
318.0338962984067
0.488692190558...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 157ms
memory: 3696kb

input:

100000
16 6 41 45
19 4 51 119
1 1 20 49
20 20 68 30
20 20 56 133
16 6 69 27
13 12 17 12
11 6 33 146
12 9 51 156
7 7 6 125
20 17 76 123
20 13 14 80
20 20 50 160
10 9 89 177
13 4 0 61
18 4 65 36
10 5 34 167
17 15 73 74
18 1 26 107
17 8 6 65
10 5 14 130
19 6 51 73
11 1 75 177
14 3 76 96
8 3 31 9
7 5 13...

output:

374.6174706480629
509.2284554272123
2.251474735072685
2108.35773640915
2531.274337012178
599.8347573254112
215.6005224988595
270.9268661372027
635.7110655017028
129.6061759140498
2456.9872192211
502.0614126286888
2584.665518016392
815.1520058325411
17.03441349946466
559.1336791689034
211.68158845709...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 161ms
memory: 3648kb

input:

100000
21 19 6 6
17 6 48 147
16 10 56 89
18 18 89 19
19 18 79 85
15 7 12 18
20 18 57 117
17 16 36 117
9 6 12 81
20 19 4 76
19 18 7 97
21 2 79 160
21 19 5 4
21 19 25 119
14 10 54 129
21 17 49 21
21 13 48 179
14 14 31 80
18 17 51 1
8 4 37 1
13 9 90 118
14 14 47 64
16 11 3 74
20 15 30 42
19 19 38 133
1...

output:

205.3554397896528
550.0648678780337
816.0461450624687
2120.57504117311
2368.254715323626
116.7625269584206
2110.323177930085
1215.784171253939
98.01769079200155
585.0343652684993
715.994457120843
741.8350733032154
164.8288945583445
1464.155538987371
783.2976070289932
1340.849197844644
1499.375882007...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 152ms
memory: 3504kb

input:

100000
14 12 55 44
19 19 55 175
18 18 25 53
18 12 61 16
22 19 85 30
21 17 53 122
22 22 80 110
20 17 46 87
19 11 64 165
5 1 20 110
19 6 46 176
22 22 45 164
22 18 77 35
22 4 69 53
17 2 34 93
22 17 33 179
16 12 79 106
17 17 64 87
22 16 60 76
12 4 43 109
18 10 51 174
11 8 60 26
19 17 5 46
14 12 75 101
2...

output:

759.4974772978524
2516.027606494228
865.194616798629
998.3981453108363
2682.832859703084
1972.151629880214
3638.749115892898
1537.931776979843
1382.218152879955
14.68981720896893
614.8675823020677
2986.650744477979
2348.165975633171
828.891768357147
220.7281428868718
1783.948886141239
1349.166583182...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 160ms
memory: 3504kb

input:

100000
22 20 49 129
22 1 9 42
29 27 41 134
29 29 72 80
27 16 71 123
28 7 21 71
25 13 70 133
28 11 27 60
29 28 68 3
23 5 1 168
27 22 79 16
29 10 17 81
27 15 90 119
29 28 86 79
22 21 69 122
27 27 49 139
16 8 11 97
16 11 4 58
12 11 32 128
18 8 35 146
29 22 27 19
30 15 50 115
15 2 24 72
18 6 80 158
13 6...

output:

2446.92214915535
83.82816397328765
4035.07012267487
5401.584595412211
2878.48141203813
509.705954752424
2207.415857830734
843.4652676112996
3897.040967023019
91.36844029168887
3445.681369164765
592.6614540997145
3265.055309950067
5957.681401682644
3188.830921300577
4354.967682393698
219.088323702231...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 166ms
memory: 3592kb

input:

100000
39 35 57 118
18 2 33 138
37 28 62 114
40 2 11 130
11 9 78 113
23 17 47 122
29 7 65 143
36 27 11 77
24 19 77 38
34 30 5 12
12 2 74 14
38 31 37 82
36 34 15 85
39 27 17 161
37 15 46 80
40 14 33 54
37 30 88 95
40 22 9 111
36 36 12 52
40 40 48 151
40 39 41 163
21 16 42 73
18 2 64 146
40 37 84 152
...

output:

8021.612925242913
241.9100912874057
6161.900464289473
349.6471069489214
706.6558630425908
1953.103910453777
1613.995982469011
1741.698967150181
2724.301882730469
545.9389900238263
254.1199390903744
4449.874007592223
2997.77752322546
3534.158747180425
2485.069602159606
1864.221080640183
8387.16744357...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 147ms
memory: 3644kb

input:

100000
9 8 74 2
47 41 64 61
42 1 75 10
33 29 33 75
43 1 76 103
48 12 73 90
50 50 35 160
50 48 13 179
49 46 77 169
30 18 74 55
44 43 77 164
15 2 31 91
49 43 31 120
49 36 39 131
43 8 23 142
33 31 25 74
25 6 58 129
28 20 31 95
8 7 1 148
37 10 52 156
11 5 54 52
49 26 33 2
20 17 13 33
38 23 89 34
50 7 60...

output:

375.4901352740601
10439.80909385172
2420.509873128336
3314.85148843527
2570.010106911053
4812.919945299563
13536.16560961096
9417.110876737315
18693.85654775467
3286.734234185642
15787.46179631324
162.7174448338264
8548.794250962402
8091.25070860343
1231.610429358239
3028.390598305441
1068.316986196...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 183ms
memory: 3712kb

input:

100000
985040437 963837006 74 178
562320397 456498961 21 57
616458849 43215539 12 112
967049313 962181597 55 20
404875500 323494205 16 148
822013814 350801410 65 117
493753261 325808227 72 151
883524417 55981080 1 165
756475575 306464991 75 65
982861539 971158777 53 2
977914232 494619050 34 80
92912...

output:

7.823031139236863e+18
5.877597797708546e+17
9.536982997099762e+16
3.89596101378828e+18
4.437520678776849e+17
1.832058841745102e+18
1.157411971581695e+18
2.521146387782492e+16
1.585510323477645e+18
3.564846423752923e+18
1.628320379389402e+18
1.174876102799313e+18
1.442096645673883e+17
3.7232130095524...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 163ms
memory: 3552kb

input:

100000
915624482 436335283 31 93
966989692 899762255 14 172
971565321 859650888 86 78
840892426 595383046 16 116
992919354 525701445 9 98
924698821 417910701 18 49
923077550 641792877 68 62
918753914 850646822 29 137
935549247 897719522 87 46
937380829 805246200 55 11
434960395 174040501 0 56
902102...

output:

1.29800266691842e+18
3.375253522633562e+18
6.03936828740798e+18
1.313133658442172e+18
8.358384550872901e+17
7.156657018919504e+17
3.352034067230078e+18
3.413794084111543e+18
5.750292420404998e+18
3.039557717337095e+18
2.96050667215241e+16
2.078691242571813e+18
6.305772657167077e+18
2.879849085657985...

result:

ok 100000 numbers