#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e2+7;
ld a[N], b[N], n;
ll A[N], B[N];
long double ans=0;
pair <ll, ll> d[10];
void Backtrack(int i){
for (int j=1;j<=4;j++){
A[i]=d[j].fi;
B[i]=d[j].se;
if (i==n){
ll cnt=0;
ld tmp1=0, tmp2=0;
for (int k=1;k<=n;k++){
if (A[k]==1){
cnt++;
tmp1+=a[k];
}
if (B[k]==1){
cnt++;
tmp2+=b[k];
}
}
tmp1=tmp1-cnt;
tmp2=tmp2-cnt;
ans=max(ans, min(tmp1, tmp2));
} else Backtrack(i+1);
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n;
d[1].fi=0; d[1].se=0;
d[2].fi=1; d[2].se=1;
d[3].fi=1; d[3].se=0;
d[4].fi=0; d[4].se=1;
for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
Backtrack(1);
cout<<fixed<<setprecision(5)<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |