QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#87237#1903. Work or Sleep!Maram#AC ✓2ms3732kbC++141.3kb2023-03-12 01:21:152023-03-12 01:21:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-12 01:21:17]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3732kb
  • [2023-03-12 01:21:15]
  • 提交

answer


#include<bits/stdc++.h>
#define int long long
#define FIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);

using namespace std;

const int N = 2e5 + 20, M = 1e6 + 5;
const int mod = 998244353;
void debug() {
#ifdef Debug
    freopen("in.txt","r",stdin);
    freopen("out.txt","w",stdout);
#endif
}
#define ld long double
#define eps 1e-9
void getAnswer()
{
    ld x,t;
    cin >> x >> t;
    ld pa = x / (t / 6);
    ld pb = (100 - x) / (t / 3 - t / 6);
    ld lo = 0, hi = t / 3;
    ld maxi = 0;
    while(hi - lo > eps)
    {
        ld mid1 = lo + (hi - lo) / 3;
        ld mid2 = hi - (hi - lo) / 3;
        ld ans1, ans2;
        if(mid1 - t / 6 > eps)
            ans1 = x + (mid1 - t / 6) * pb;
        else
            ans1 = mid1 * pa;
        if(mid2 - t / 6 > eps)
            ans2 = x + (mid2 - t / 6) * pb;
        else
            ans2 = mid2 * pa;
        if((ans1 * (t - mid1)) - (ans2 * (t - mid2)) > eps)
            hi = mid2 - 0.0000001;
        else
            lo = mid1 + 0.0000001;
        maxi = max({maxi, ans1 * (t - mid1), ans2 * (t -mid2)});
    }
    cout << fixed << setprecision(10) << maxi << "\n";
}
signed main()
{
    FIO
    debug();
    int t = 1;
    //cin >> t;
    while(t--)
        getAnswer();
    return 0;

}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

75 24

output:

1600.0000000000

result:

ok found '1600.0000000', expected '1600.0000000', error '0.0000000'

Test #2:

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

input:

100 24

output:

1999.9999987074

result:

ok found '1999.9999987', expected '2000.0000000', error '0.0000000'

Test #3:

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

input:

77 123

output:

8214.2608695652

result:

ok found '8214.2608696', expected '8214.2608696', error '0.0000000'

Test #4:

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

input:

1 1

output:

66.6666623864

result:

ok found '66.6666624', expected '66.6666667', error '0.0000001'

Test #5:

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

input:

0 1

output:

66.6666623286

result:

ok found '66.6666623', expected '66.6666667', error '0.0000001'

Test #6:

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

input:

99 1

output:

82.4999998618

result:

ok found '82.4999999', expected '82.5000000', error '0.0000000'

Test #7:

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

input:

100 1

output:

83.3333331863

result:

ok found '83.3333332', expected '83.3333333', error '0.0000000'

Test #8:

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

input:

11 1

output:

66.6666629648

result:

ok found '66.6666630', expected '66.6666667', error '0.0000001'

Test #9:

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

input:

79 7

output:

470.2222222222

result:

ok found '470.2222222', expected '470.2222222', error '0.0000000'

Test #10:

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

input:

11 14

output:

933.3333229190

result:

ok found '933.3333229', expected '933.3333333', error '0.0000000'

Test #11:

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

input:

77 67

output:

4474.4347826087

result:

ok found '4474.4347826', expected '4474.4347826', error '0.0000000'

Test #12:

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

input:

29 50

output:

3333.3333243415

result:

ok found '3333.3333243', expected '3333.3333333', error '0.0000000'

Test #13:

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

input:

78 981

output:

65667.5454545454

result:

ok found '65667.5454545', expected '65667.5454545', error '0.0000000'

Test #14:

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

input:

77 2418

output:

161480.3478260870

result:

ok found '161480.3478261', expected '161480.3478261', error '0.0000000'

Test #15:

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

input:

76 8374

output:

558499.2777777778

result:

ok found '558499.2777778', expected '558499.2777778', error '0.0000000'

Test #16:

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

input:

6 7614

output:

507599.9999954509

result:

ok found '507599.9999955', expected '507600.0000000', error '0.0000000'

Test #17:

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

input:

80 45826

output:

3093255.0000000000

result:

ok found '3093255.0000000', expected '3093255.0000000', error '0.0000000'

Test #18:

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

input:

74 56158

output:

3743866.6666666141

result:

ok found '3743866.6666666', expected '3743866.6666667', error '0.0000000'

Test #19:

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

input:

75 33510

output:

2234000.0000000000

result:

ok found '2234000.0000000', expected '2234000.0000000', error '0.0000000'

Test #20:

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

input:

76 42240

output:

2817173.3333333333

result:

ok found '2817173.3333333', expected '2817173.3333333', error '0.0000000'

Test #21:

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

input:

77 53971

output:

3604324.1739130434

result:

ok found '3604324.1739130', expected '3604324.1739130', error '0.0000000'

Test #22:

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

input:

78 75573

output:

5058810.8181818181

result:

ok found '5058810.8181818', expected '5058810.8181818', error '0.0000000'

Test #23:

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

input:

79 98727

output:

6631947.0476190476

result:

ok found '6631947.0476190', expected '6631947.0476191', error '0.0000000'

Test #24:

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

input:

80 13513

output:

912127.5000000000

result:

ok found '912127.5000000', expected '912127.5000000', error '0.0000000'

Test #25:

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

input:

81 35449

output:

2408044.3508771930

result:

ok found '2408044.3508772', expected '2408044.3508772', error '0.0000000'

Test #26:

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

input:

82 65290

output:

4471155.9259259259

result:

ok found '4471155.9259259', expected '4471155.9259259', error '0.0000000'

Test #27:

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

input:

83 67552

output:

4673008.9411764706

result:

ok found '4673008.9411765', expected '4673008.9411765', error '0.0000000'

Test #28:

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

input:

84 80720

output:

5650399.9999999618

result:

ok found '5650400.0000000', expected '5650400.0000000', error '0.0000000'

Test #29:

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

input:

0 100000

output:

6666666.6666563745

result:

ok found '6666666.6666564', expected '6666666.6666667', error '0.0000000'

Test #30:

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

input:

75 100000

output:

6666666.6666666667

result:

ok found '6666666.6666667', expected '6666666.6666667', error '0.0000000'

Test #31:

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

input:

100 100000

output:

8333333.3333325730

result:

ok found '8333333.3333326', expected '8333333.3333333', error '0.0000000'

Test #32:

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

input:

40 100000

output:

6666666.6666618637

result:

ok found '6666666.6666619', expected '6666666.6666667', error '0.0000000'

Test #33:

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

input:

76 100000

output:

6669444.4444444444

result:

ok found '6669444.4444444', expected '6669444.4444444', error '0.0000000'