# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
57130 |
2018-07-14T06:12:33 Z |
Scayre |
Sure Bet (CEOI17_sure) |
C++14 |
|
177 ms |
16956 KB |
///////////////////////////
// INFO //
// //
// Handle -> Scayre //
// //
// Template vers. 1.0 //
// //
// The only way is up //
// //
///////////////////////////
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
#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 <complex>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define ll long long
#define ld long double
#define ull unsigned ll
#define ioi exit(0);
#define f first
#define s second
#define inf (int)1e9 + 7
#define NFS ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp(x,y) make_pair(x,y)
#define lb(x) lower_bound(x)
#define ub(x) upper_bound(x)
#define pb push_back
#define ppb pop_back
#define endl "\n"
#define in(x) insert(x)
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define pw2(x) (1<<x) //2^x
#define forit(it,v) for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it)
#define sqr(x) ((x) * 1ll * (x))
using namespace std;
const int N = (int)5e5 + 7, MOD = (int)1e9 + 7;
int n;
double a[N],b[N];
double cnt,cnt1;
double res;
int l=1,L=1;
bool cmp(double a,double b){
return (double)a>(double)b;
}
int main(){
#ifdef IOI2019
freopen ("in.txt", "r", stdin);
#endif
NFS
cin >> n;
for(int i=1;i<=n;i++){
cin >> a[i] >> b[i];
}
sort(a+1,a+n+1,cmp);
sort(b+1,b+n+1,cmp);
for(int i=1;i<=n*2;i++){
if(cnt<=cnt1){
cnt+=(double)a[l];
l++;
}
else{
cnt1+=(double)b[L];
L++;
}
res=max((double)res,(double)min((double)cnt-i,(double)cnt1-i));
}
printf("%.4lf",(double)res);
#ifdef IOI2019
cout << "\nTime Elapsed : " << clock () * 1.0 / CLOCKS_PER_SEC << endl;
#endif
ioi
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
3 ms |
496 KB |
Output is correct |
5 |
Correct |
2 ms |
496 KB |
Output is correct |
6 |
Correct |
4 ms |
584 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
3 ms |
496 KB |
Output is correct |
5 |
Correct |
2 ms |
496 KB |
Output is correct |
6 |
Correct |
4 ms |
584 KB |
Output is correct |
7 |
Correct |
3 ms |
584 KB |
Output is correct |
8 |
Correct |
2 ms |
588 KB |
Output is correct |
9 |
Correct |
2 ms |
592 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
11 |
Correct |
2 ms |
672 KB |
Output is correct |
12 |
Correct |
5 ms |
672 KB |
Output is correct |
13 |
Correct |
4 ms |
804 KB |
Output is correct |
14 |
Correct |
4 ms |
804 KB |
Output is correct |
15 |
Correct |
4 ms |
804 KB |
Output is correct |
16 |
Correct |
5 ms |
812 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
496 KB |
Output is correct |
3 |
Correct |
2 ms |
496 KB |
Output is correct |
4 |
Correct |
3 ms |
496 KB |
Output is correct |
5 |
Correct |
2 ms |
496 KB |
Output is correct |
6 |
Correct |
4 ms |
584 KB |
Output is correct |
7 |
Correct |
3 ms |
584 KB |
Output is correct |
8 |
Correct |
2 ms |
588 KB |
Output is correct |
9 |
Correct |
2 ms |
592 KB |
Output is correct |
10 |
Correct |
2 ms |
672 KB |
Output is correct |
11 |
Correct |
2 ms |
672 KB |
Output is correct |
12 |
Correct |
5 ms |
672 KB |
Output is correct |
13 |
Correct |
4 ms |
804 KB |
Output is correct |
14 |
Correct |
4 ms |
804 KB |
Output is correct |
15 |
Correct |
4 ms |
804 KB |
Output is correct |
16 |
Correct |
5 ms |
812 KB |
Output is correct |
17 |
Correct |
114 ms |
3776 KB |
Output is correct |
18 |
Correct |
134 ms |
5124 KB |
Output is correct |
19 |
Correct |
131 ms |
6620 KB |
Output is correct |
20 |
Correct |
142 ms |
8084 KB |
Output is correct |
21 |
Correct |
135 ms |
9756 KB |
Output is correct |
22 |
Correct |
177 ms |
11064 KB |
Output is correct |
23 |
Correct |
123 ms |
12560 KB |
Output is correct |
24 |
Correct |
109 ms |
13816 KB |
Output is correct |
25 |
Correct |
107 ms |
15312 KB |
Output is correct |
26 |
Correct |
119 ms |
16956 KB |
Output is correct |