QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#394094 | #1880. Nikanor Loves Games | deepthought | WA | 1ms | 3980kb | C++23 | 1.0kb | 2024-04-20 00:08:12 | 2024-04-20 00:08:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
struct state{
int a, b, x;
};
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
// if you lose anyways get (1, 1) ?
vector <int> v;
vector <state> arr;
for(int i = 0; i < n; i++) {
int a, b, x;
cin >> a >> b >> x;
if(a > b) swap(a, b);
arr.push_back({a, b, x});
v.push_back(a);
v.push_back(b);
}
sort(v.begin(), v.end());
double ans = - 1000000000.0;
for(int i = 0; i < 2 * n; i++) {
for(int j = i + 1; j < 2 * n; j++) {
double fs = v[i];
double ss = v[j];
double sum = - (fs * ss);
for(int k = 0; k < n; k++) {
double su = 0;
su += (fs >= arr[k].a ? arr[k].x : -arr[k].x);
su += (fs >= arr[k].b ? arr[k].x : -arr[k].x);
su += (ss >= arr[k].a ? arr[k].x : -arr[k].x);
su += (ss >= arr[k].b ? arr[k].x : -arr[k].x);
sum += 0.25 * su;
}
ans = max(ans, sum);
}
}
cout << setprecision(12) << fixed << ans << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3980kb
input:
2 1 4 15 3 5 10
output:
2.500000000000
result:
ok found '2.5000000', expected '2.5000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
1 2 2 8
output:
4.000000000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3812kb
input:
3 94 68 49 51 2 63 26 85 20
output:
-111.000000000000
result:
wrong answer 1st numbers differ - expected: '-73.0000000', found: '-111.0000000', error = '0.5205479'