# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
865404 |
2023-10-24T07:59:29 Z |
vjudge1 |
Sure Bet (CEOI17_sure) |
C++17 |
|
1 ms |
4696 KB |
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <fstream>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(x) x.begin(),x.end()
#define pb push_back
#define ent "\n"
const int maxn = (int)3e5 + 13;
const ll inf = (long long)1e18 + 20;
const int mod = (int)1e9 + 7;
int n;
ld a[maxn],b[maxn];
ld pref[maxn];
int get(int x,int y){
int ans = x / pow(4,y);
ans %= 4;
return ans;
}
void solve(){
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);
ld mx =0 ,sum = 0,sum1 = 0;
for(int i = n ; i >= 1 ; i --){
sum += a[i];
mx = max(mx,min(sum,b[n]) - (n - i + 2));
}
for(int i = n ; i >= 1 ; i --){
sum1 += b[i];
mx = max(mx,min(sum1,a[n]) - (n - i + 2));
}
cout << fixed << mx << ent;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int t = 1;
//cin >> t;
while(t --){
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
4696 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |