QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#86526#1903. Work or Sleep!rania__#AC ✓3ms3768kbC++141.4kb2023-03-10 00:49:452023-03-10 00:49:47

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-10 00:49:47]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3768kb
  • [2023-03-10 00:49:45]
  • 提交

answer

#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

#define ll long long
using namespace std;
using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int N = 2e5+7, P1 = 31, P2 = 37, mod= 1e9 + 7;

double x,t;
double f(double val)
{
    double rem = 100-x;
    double  h = t/3 - t/6;
    return (x + (val-t/6)*(rem/h)) * (t-val);
}
double ternary_search(double l, double r) {
    double eps = 1e-9;              //set the error limit here
    while (r - l > eps) {
        double m1 = l + (r - l) / 3;
        double m2 = r - (r - l) / 3;
        double f1 = f(m1);      //evaluates the function at m1
        double f2 = f(m2);      //evaluates the function at m2
        if (f1 < f2)
            l = m1;
        else
            r = m2;
    }
    return f(l);                    //return the maximum of f(x) in [l, r]
}
void doWork() {
  cin >> x >> t;
  double l = t/6,r = t/3;
  cout <<fixed << setprecision(10) <<  ternary_search(l,r) << endl;
}


int main() {
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
//    freopen("bisector.in","r",stdin);
//    freopen("bisector.out","w",stdout);
    int tst = 1;
    // cout << primes.size() << endl;
    //cin >> t;
    while (tst--) {
        doWork();
    }
    return 0;
}

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

詳細信息

Test #1:

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

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

input:

100 24

output:

2000.0000000000

result:

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

Test #3:

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

input:

77 123

output:

8214.2608695652

result:

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

Test #4:

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

input:

1 1

output:

66.6666664055

result:

ok found '66.6666664', expected '66.6666667', error '0.0000000'

Test #5:

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

input:

0 1

output:

66.6666664020

result:

ok found '66.6666664', expected '66.6666667', error '0.0000000'

Test #6:

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

input:

99 1

output:

82.5000000000

result:

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

Test #7:

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

input:

100 1

output:

83.3333333333

result:

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

Test #8:

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

input:

11 1

output:

66.6666664408

result:

ok found '66.6666664', expected '66.6666667', error '0.0000000'

Test #9:

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

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

input:

11 14

output:

933.3333331483

result:

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

Test #11:

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

input:

77 67

output:

4474.4347826087

result:

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

Test #12:

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

input:

29 50

output:

3333.3333331926

result:

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

Test #13:

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

input:

78 981

output:

65667.5454545454

result:

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

Test #14:

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

input:

77 2418

output:

161480.3478260869

result:

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

Test #15:

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

input:

76 8374

output:

558499.2777777776

result:

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

Test #16:

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

input:

6 7614

output:

507599.9999997523

result:

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

Test #17:

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

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

input:

74 56158

output:

3743866.6666666633

result:

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

Test #19:

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

input:

75 33510

output:

2233999.9999999995

result:

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

Test #20:

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

input:

76 42240

output:

2817173.3333333330

result:

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

Test #21:

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

input:

77 53971

output:

3604324.1739130435

result:

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

Test #22:

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

input:

78 75573

output:

5058810.8181818174

result:

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

Test #23:

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

input:

79 98727

output:

6631947.0476190466

result:

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

Test #24:

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

input:

80 13513

output:

912127.4999999999

result:

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

Test #25:

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

input:

81 35449

output:

2408044.3508771928

result:

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

Test #26:

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

input:

82 65290

output:

4471155.9259259244

result:

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

Test #27:

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

input:

83 67552

output:

4673008.9411764694

result:

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

Test #28:

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

input:

84 80720

output:

5650400.0000000000

result:

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

Test #29:

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

input:

0 100000

output:

6666666.6666664584

result:

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

Test #30:

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

input:

75 100000

output:

6666666.6666666660

result:

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

Test #31:

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

input:

100 100000

output:

8333333.3333333340

result:

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

Test #32:

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

input:

40 100000

output:

6666666.6666665692

result:

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

Test #33:

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

input:

76 100000

output:

6669444.4444444440

result:

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