QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369222 | #1880. Nikanor Loves Games | Nelt | WA | 1ms | 3868kb | C++14 | 1.0kb | 2024-03-27 22:15:40 | 2024-03-27 22:16:01 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#define ll long long
#define endl "\n"
using namespace std;
void solve()
{
ll n;
cin >> n;
ll a[n], b[n], x[n];
for (ll i = 0; i < n; i++)
cin >> a[i] >> b[i] >> x[i];
long double ans = 0, res;
for (ll a1 = 1; a1 <= 20; a1++)
for (ll b1 = 1; b1 <= 20; b1++)
{
res = 0;
long double p = 1;
for (ll i = 0; i < n; i++)
{
ll cnt = 0;
cnt += (a[i] <= a1) + (a[i] <= b1);
cnt += (b[i] <= a1) + (b[i] <= b1);
res += x[i] * p * (2 * (cnt / 4.0) - 1);
p *= cnt / 2.0 - 1;
}
ans = max(ans, res - a1 * b1);
}
cout << setprecision(10) << fixed << ans << endl;
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
ll t = 1;
// precomp();
// cin >> t;
for (ll i = 1; i <= t; i++)
solve();
// cerr << "\nTime elapsed: " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n";
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3692kb
input:
2 1 4 15 3 5 10
output:
2.5000000000
result:
ok found '2.5000000', expected '2.5000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 2 2 8
output:
4.0000000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3732kb
input:
3 94 68 49 51 2 63 26 85 20
output:
0.0000000000
result:
wrong answer 1st numbers differ - expected: '-73.0000000', found: '0.0000000', error = '1.0000000'