QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#86525 | #1903. Work or Sleep! | Zuqa# | AC ✓ | 3ms | 3768kb | C++17 | 2.0kb | 2023-03-10 00:25:39 | 2023-03-10 00:25:43 |
Judging History
answer
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#define el '\n'
#define FIO ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
typedef unsigned long long ull;
template<typename T, typename X>
using hashTable = gp_hash_table<T, X>;
template<typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// mt19937_64 for long long
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const ld eps = 1e-18;
ll x, t;
ld m, tover6, tover3;
int dcmp(ld a, ld b)
{
// a == b : 0
// a != b : != 0
// a > b : 1
// a < b : -1
// a >= b : != -1
// a <= b : != 1
return fabs(a - b) <= eps ? 0 : a < b ? -1 : 1;
}
ld solve(ld sleep)
{
ld work = t - sleep;
if(dcmp(sleep, tover3) != -1)
return work * (ld) 100.0;
else if(dcmp(sleep, tover6) != -1) // [t/6, t/3]
{
ld ada2 = (ld) x + m * (sleep - tover6);
return work * ada2;
}
else // [0, t/6 - eps]
return work * (sleep / tover6 * x);
}
void doWork()
{
cin >> x >> t;
tover6 = (ld) t / (ld) 6.0, tover3 = (ld) t / (ld) 3.0;
m = (100.0 - x) / tover6;
int itr = 0;
ld s = 0, e = t, m1, m2, d, x1, x2;
while(itr < 300)
{
itr++;
d = (e - s) / (ld) 3.0;
m1 = s + d, m2 = e - d;
x1 = solve(m1), x2 = solve(m2);
if(dcmp(x1, x2) == 1)
e = m2;
else
s = m1;
}
cout << fixed << setprecision(8) << max(solve(s), solve(e));
}
signed main()
{
FIO
int T = 1;
// cin >> T;
for(int i = 1; i <= T; i++)
doWork();
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3632kb
input:
75 24
output:
1600.00000000
result:
ok found '1600.0000000', expected '1600.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
100 24
output:
2000.00000000
result:
ok found '2000.0000000', expected '2000.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3648kb
input:
77 123
output:
8214.26086957
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.66666667
result:
ok found '66.6666667', expected '66.6666667', error '0.0000000'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
0 1
output:
66.66666667
result:
ok found '66.6666667', expected '66.6666667', error '0.0000000'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
99 1
output:
82.50000000
result:
ok found '82.5000000', expected '82.5000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 2ms
memory: 3660kb
input:
100 1
output:
83.33333333
result:
ok found '83.3333333', expected '83.3333333', error '0.0000000'
Test #8:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
11 1
output:
66.66666667
result:
ok found '66.6666667', expected '66.6666667', error '0.0000000'
Test #9:
score: 0
Accepted
time: 2ms
memory: 3636kb
input:
79 7
output:
470.22222222
result:
ok found '470.2222222', expected '470.2222222', error '0.0000000'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
11 14
output:
933.33333333
result:
ok found '933.3333333', expected '933.3333333', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3716kb
input:
77 67
output:
4474.43478261
result:
ok found '4474.4347826', expected '4474.4347826', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
29 50
output:
3333.33333333
result:
ok found '3333.3333333', expected '3333.3333333', error '0.0000000'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3648kb
input:
78 981
output:
65667.54545455
result:
ok found '65667.5454545', expected '65667.5454545', error '0.0000000'
Test #14:
score: 0
Accepted
time: 2ms
memory: 3644kb
input:
77 2418
output:
161480.34782609
result:
ok found '161480.3478261', expected '161480.3478261', error '0.0000000'
Test #15:
score: 0
Accepted
time: 2ms
memory: 3652kb
input:
76 8374
output:
558499.27777778
result:
ok found '558499.2777778', expected '558499.2777778', error '0.0000000'
Test #16:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
6 7614
output:
507600.00000000
result:
ok found '507600.0000000', expected '507600.0000000', error '0.0000000'
Test #17:
score: 0
Accepted
time: 2ms
memory: 3768kb
input:
80 45826
output:
3093255.00000000
result:
ok found '3093255.0000000', expected '3093255.0000000', error '0.0000000'
Test #18:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
74 56158
output:
3743866.66666667
result:
ok found '3743866.6666667', expected '3743866.6666667', error '0.0000000'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3712kb
input:
75 33510
output:
2234000.00000000
result:
ok found '2234000.0000000', expected '2234000.0000000', error '0.0000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
76 42240
output:
2817173.33333333
result:
ok found '2817173.3333333', expected '2817173.3333333', error '0.0000000'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3624kb
input:
77 53971
output:
3604324.17391304
result:
ok found '3604324.1739130', expected '3604324.1739130', error '0.0000000'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3724kb
input:
78 75573
output:
5058810.81818182
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.04761905
result:
ok found '6631947.0476191', expected '6631947.0476191', error '0.0000000'
Test #24:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
80 13513
output:
912127.50000000
result:
ok found '912127.5000000', expected '912127.5000000', error '0.0000000'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3668kb
input:
81 35449
output:
2408044.35087719
result:
ok found '2408044.3508772', expected '2408044.3508772', error '0.0000000'
Test #26:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
82 65290
output:
4471155.92592593
result:
ok found '4471155.9259259', expected '4471155.9259259', error '0.0000000'
Test #27:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
83 67552
output:
4673008.94117647
result:
ok found '4673008.9411765', expected '4673008.9411765', error '0.0000000'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
84 80720
output:
5650400.00000000
result:
ok found '5650400.0000000', expected '5650400.0000000', error '0.0000000'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3712kb
input:
0 100000
output:
6666666.66666667
result:
ok found '6666666.6666667', expected '6666666.6666667', error '0.0000000'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3692kb
input:
75 100000
output:
6666666.66666667
result:
ok found '6666666.6666667', expected '6666666.6666667', error '0.0000000'
Test #31:
score: 0
Accepted
time: 2ms
memory: 3652kb
input:
100 100000
output:
8333333.33333333
result:
ok found '8333333.3333333', expected '8333333.3333333', error '0.0000000'
Test #32:
score: 0
Accepted
time: 3ms
memory: 3696kb
input:
40 100000
output:
6666666.66666667
result:
ok found '6666666.6666667', expected '6666666.6666667', error '0.0000000'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3656kb
input:
76 100000
output:
6669444.44444444
result:
ok found '6669444.4444444', expected '6669444.4444444', error '0.0000000'