QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#769609 | #9620. osu!mania | proven# | AC ✓ | 0ms | 3848kb | C++20 | 1.4kb | 2024-11-21 18:32:59 | 2024-11-21 18:33:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
#define double long double
void solve() {
int ppmax;
cin >> ppmax;
int a, b, c, d, e, f;
cin >> a >> b >> c >> d >> e >> f;
int acc = 300 * a + 300 * b + 200 * c + 100 * d + 50 * e;
int acc2 = 300 * (a + b + c + d + e + f);
double res = (double)acc / (double)acc2;
cout << fixed << setprecision(2) << res * 100 << "%" << " ";
int pp = (320 * a + 300 * b + 200 * c + 100 * d + 50 * e) - (8 * 32 * (a + b + c + d + e + f));
if(pp <= 0) {
cout << 0 << endl;
return;
}
int pp2 = 320 * (a + b + c + d + e + f);
pp *= 5 * ppmax;
int l = 0, r = 1e9, ans = -1;
auto check = [&] (int x) {
return x * pp2 <= pp;
};
while(l <= r) {
int mid = (l + r) >> 1;
if(check(mid)) {
ans = mid;
l = mid + 1;
}
else r = mid - 1;
}
int d1 = ans * pp2 - pp;
int d2 = (ans + 1) * pp2 - pp;
if(d1 < 0) d1 *= -1;
if(d1 < d2) cout << ans << endl;
else cout << ans + 1 << endl;
}
/*
630
3029 2336 377 41 10 61
3000
20000 10000 0 0 0 0
*/
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
cin >> T;
while(T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3848kb
input:
18 1279 4624 4458 1109 220 103 314 753 3604 3204 391 33 9 29 807 5173 3986 763 84 29 96 718 576 461 60 5 2 7 947 4058 3268 764 169 42 158 568 2660 1731 161 16 6 15 641 4181 3126 656 56 10 43 630 3029 2336 377 41 10 61 529 1991 1354 181 11 9 5 1802 8321 2335 115 19 11 27 1645 3965 1087 41 6 1 13 1688...
output:
91.54% 543 97.40% 543 95.75% 523 97.12% 513 93.38% 499 98.16% 444 96.19% 430 96.20% 423 97.74% 400 99.19% 1604 99.38% 1482 99.14% 1465 98.53% 1251 100.00% 2688 100.00% 1792 100.00% 3000 52.78% 0 0.00% 0
result:
ok 18 lines