# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1027179 |
2024-07-19T01:47:33 Z |
thdh__ |
Sure Bet (CEOI17_sure) |
C++17 |
|
1 ms |
2392 KB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define eb emplace_back
#define pu push
#define ins insert
#define bruh ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ff(x,a,b,c) for (auto x=a;x<=b;x+=c)
#define fd(x,a,b,c) for (auto x=a;x>=b;x-=c)
#define fi first
#define se second
#define int ll
using namespace std;
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int, int> ii;
const int N = 1e5+5;
const int mod = 1e9+7;
const int INF = 1e18;
using cd = complex<double>;
const long double PI = acos(-1);
int power(int a,int b) {ll x = 1;if (a >= mod) a%=mod; while (b) {if (b & 1) x = x*a % mod;a = a*a % mod;b>>=1;}return x;}
int n;
long double a[N],b[N];
long double suma = 0.0,sumb = 0.0,ans = 0.0;
bool checka[N],checkb[N];
void solve()
{
cin>>n;
for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
sort(a+1,a+n+1,greater<long double>()); sort(b+1,b+n+1, greater<long double>());
int i = 1,j = 1;
while (i<=n && j<=n)
{
if (!checka[i]) suma += a[i];
if (!checkb[j]) sumb += b[j];
checka[i] = true,checkb[j] = true;
ans = max(ans,min((suma-((long double)(i+j))),(sumb-((long double)(i+j)))));
if (suma>=sumb) j++;
if (suma<=sumb) i++;
}
cout<<ans;
}
signed main()
{
bruh
//freopen("input.inp","r",stdin);
//freopen("output.inp","w",stdout);
int t = 1;
//cin>>t;
while (t--)
{
solve();
cout<<"\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |