# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865532 |
2023-10-24T09:31:02 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
58 ms |
2132 KB |
#include <bits/stdc++.h>
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define adiyer(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) x.begin(), x.end()
#define eb emplace_back
#define elif else if
#define uns unsigned
#define emp empty()
#define S second
#define F first
#define int long long
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef pair < ll, ll > pll;
typedef pair < int, int > pi;
typedef pair < ldb, ldb > pldb;
typedef vector < pair < ll, ll > > vpll;
typedef vector < pair < int, int > > vpi;
const int N = 1e5 + 123;
const int mod = 1e9 + 7;
const int mxlg = 30;
const int P = 31;
const int K = 4;
const ll inf = 1e9 + 10;
ll n, j;
double x, y, res;
double a[N], b[N];
void output(){
cin >> n;
for(int i = 1; i <= n; i++) cin >> a[i] >> b[i];
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1), j = n;
for(int i = n; i >= 1; i--){
res = max(res, min(x, y));
while(x <= y && j > 0){
x += a[j--], x--, y--;
res = max(res, min(x, y));
}
y += b[i], x--, y--;
res = max(res, min(x, y));
}
printf("%.4lf",(double)res);
}
const bool cases = 0;
signed main(){
// file("disrupt");
adiyer();
int tt = 1;
if(cases) cin >> tt;
for(int i = 1; i <= tt; i++){
// cout << "Case " << i << ":\n";
output();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
348 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
56 ms |
1832 KB |
Output is correct |
18 |
Correct |
54 ms |
1996 KB |
Output is correct |
19 |
Correct |
57 ms |
2132 KB |
Output is correct |
20 |
Correct |
54 ms |
1872 KB |
Output is correct |
21 |
Correct |
58 ms |
1872 KB |
Output is correct |
22 |
Correct |
53 ms |
1764 KB |
Output is correct |
23 |
Correct |
54 ms |
1984 KB |
Output is correct |
24 |
Correct |
54 ms |
1900 KB |
Output is correct |
25 |
Correct |
56 ms |
2112 KB |
Output is correct |
26 |
Correct |
58 ms |
1876 KB |
Output is correct |