QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#60120 | #1903. Work or Sleep! | Sa3tElSefr# | AC ✓ | 2ms | 3928kb | C++23 | 2.0kb | 2022-11-02 22:40:56 | 2022-11-02 22:40:58 |
Judging History
answer
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
//#pragma GCC optimize("O3")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#define ll long long
#define ld long double
using namespace std;
const int N = 2e5 + 5, lg = 19, mod = 998244353;
const int OO = 1e9 + 5;
ld x, T;
ld work(ld t) {
ld P_t;
if (t > T / 3) {
P_t = 100;
} else if (t > T / 6) {
P_t = x + ((t - T / 6) / (T / 3 - T / 6)) * (100 - x);
} else {
P_t = (t / T) * 6 * x;
}
return (T - t) * P_t;
}
ld bs(ld st, ld en) {
for (int i = 0; i < 100; ++i) {
ld m1 = st + (en - st) / 3;
ld m2 = en - (en - st) / 3;
if (work(m1) > work(m2)) {
en = m2;
} else {
st = m1;
}
}
return en;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> x >> T;
ld ans1 = bs(0, T / 3);
ld ans2 = bs(T / 6, T / 6);
ld ans = ans1;
if (work(ans2) > work(ans)) {
ans = ans2;
}
cout << fixed << setprecision(10);
cout << work(ans) << '\n';
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3908kb
input:
75 24
output:
1600.0000000000
result:
ok found '1600.0000000', expected '1600.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
100 24
output:
2000.0000000000
result:
ok found '2000.0000000', expected '2000.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3732kb
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: 3856kb
input:
1 1
output:
66.6666666667
result:
ok found '66.6666667', expected '66.6666667', error '0.0000000'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3656kb
input:
0 1
output:
66.6666666667
result:
ok found '66.6666667', expected '66.6666667', error '0.0000000'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3660kb
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: 3852kb
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: 3732kb
input:
11 1
output:
66.6666666667
result:
ok found '66.6666667', expected '66.6666667', error '0.0000000'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3772kb
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: 3716kb
input:
11 14
output:
933.3333333333
result:
ok found '933.3333333', expected '933.3333333', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3732kb
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: 3848kb
input:
29 50
output:
3333.3333333333
result:
ok found '3333.3333333', expected '3333.3333333', error '0.0000000'
Test #13:
score: 0
Accepted
time: 2ms
memory: 3776kb
input:
78 981
output:
65667.5454545455
result:
ok found '65667.5454545', expected '65667.5454545', error '0.0000000'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3748kb
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: 3712kb
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: 3756kb
input:
6 7614
output:
507600.0000000000
result:
ok found '507600.0000000', expected '507600.0000000', error '0.0000000'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3748kb
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: 3860kb
input:
74 56158
output:
3743866.6666666667
result:
ok found '3743866.6666667', expected '3743866.6666667', error '0.0000000'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3652kb
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: 3772kb
input:
76 42240
output:
2817173.3333333333
result:
ok found '2817173.3333333', expected '2817173.3333333', error '0.0000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
77 53971
output:
3604324.1739130435
result:
ok found '3604324.1739130', expected '3604324.1739130', error '0.0000000'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3752kb
input:
78 75573
output:
5058810.8181818182
result:
ok found '5058810.8181818', expected '5058810.8181818', error '0.0000000'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3848kb
input:
79 98727
output:
6631947.0476190476
result:
ok found '6631947.0476190', expected '6631947.0476191', error '0.0000000'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3776kb
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: 3736kb
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: 3748kb
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: 3736kb
input:
83 67552
output:
4673008.9411764706
result:
ok found '4673008.9411765', expected '4673008.9411765', error '0.0000000'
Test #28:
score: 0
Accepted
time: 2ms
memory: 3748kb
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: 3756kb
input:
0 100000
output:
6666666.6666666667
result:
ok found '6666666.6666667', expected '6666666.6666667', error '0.0000000'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3928kb
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: 3712kb
input:
100 100000
output:
8333333.3333333333
result:
ok found '8333333.3333333', expected '8333333.3333333', error '0.0000000'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3720kb
input:
40 100000
output:
6666666.6666666667
result:
ok found '6666666.6666667', expected '6666666.6666667', error '0.0000000'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
76 100000
output:
6669444.4444444444
result:
ok found '6669444.4444444', expected '6669444.4444444', error '0.0000000'