# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
842762 |
2023-09-03T11:09:12 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
64 ms |
7520 KB |
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define fi first
#define se second
#define int long long
#define pii pair<int,int>
#define piii pair<int, pair<int, int>>
#define v(int) vector<int>
#define si size()
#define foe(i,a,b) for(int i=a;i<=b;++i)
#define fol(i,a,b) for(int i=a;i<b;++i)
#define pb push_back
#define Bit(mask,i) (1<<i)&mask
#define offBit(mask,i) (1<<i)^mask
#define onBit(mask,i) (1<<i)mask
#define CNT(x) __builtin_popcountll(x)
const int mod = 1e9+7;
const int base = 2309;
const int inf = 1e18;
const int N = 1e6+10;
const int LG = 20;
// ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄▄ ▄ ▄▄▄▄
// █▄▄█ █ █ █ █ █▄▄█ █ █ ██ █ █ ▄▄
// █ █ █▄▄█ █▄▄█ █ █ █▄▄█ █ ██ █▄▄█
int n;
double a[N], b[N];
double ans, A, B;
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n;
fol(i,0,n)
{
cin >> a[i] >> b[i];
}
sort(a, a + n, greater<double>());
sort(b, b + n, greater<double>());
int l = 0, r = 0;
while(l < n || r < n)
{
if((A < B && l < n) || r == n)
A += a[l++];
else
B += b[r++];
A --;
B --;
ans = max(ans, min(A, B));
}
cout << fixed << setprecision(4) << ans << "\n";
cerr << "\n" << (double)clock() / CLOCKS_PER_SEC * 1000 << " ms";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
0 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2392 KB |
Output is correct |
8 |
Correct |
0 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1 ms |
2396 KB |
Output is correct |
15 |
Correct |
1 ms |
2396 KB |
Output is correct |
16 |
Correct |
1 ms |
2396 KB |
Output is correct |
17 |
Correct |
58 ms |
7024 KB |
Output is correct |
18 |
Correct |
53 ms |
7020 KB |
Output is correct |
19 |
Correct |
58 ms |
6880 KB |
Output is correct |
20 |
Correct |
56 ms |
6940 KB |
Output is correct |
21 |
Correct |
58 ms |
7484 KB |
Output is correct |
22 |
Correct |
57 ms |
7024 KB |
Output is correct |
23 |
Correct |
54 ms |
6976 KB |
Output is correct |
24 |
Correct |
54 ms |
7028 KB |
Output is correct |
25 |
Correct |
54 ms |
7112 KB |
Output is correct |
26 |
Correct |
64 ms |
7520 KB |
Output is correct |