Submission #121326

# Submission time Handle Problem Language Result Execution time Memory
121326 2019-06-26T10:29:47 Z killB0x Sure Bet (CEOI17_sure) C++14
100 / 100
91 ms 3228 KB
using namespace std;
    #include <bits/stdc++.h>
    typedef long long int ll;
    typedef unsigned long long int ull;
    typedef pair<int,int> ii;
    typedef pair<ll,ll> dl;
    typedef vector<ii> vii;
    typedef vector<dl> vdll;
    typedef vector<int> vi;
    typedef vector<ll> vll;
    typedef vector<string> vs;
    #define pb push_back
    #define mp make_pair
    #define ft first
    #define sc second
    #define in insert
    #define bs binary_search
    #define INF LLONG_MAX
    #define rc(s) return cout << s,0
    #define int ll
    const ll mod=1e9+7;
    const int N=100005;
    #define int ll
    /*----------------------------*/
    /*----------------------------*/
    int32_t main() {
    	//freopen("sol.in","r",stdin);
    	//freopen("sol.out","w",stdout);
        /**///------------------------///**/
        /**/ios::sync_with_stdio(false);/**/
        /**///------------------------///**/
        int n;
	cin>>n;
    	double a,b;
    	vector<double> x,y;
    	for(int i=1;i<=n;i++)cin>>a>>b,x.pb(a),y.pb(b);
    	sort(x.begin(),x.end());
    	sort(y.begin(),y.end());
    	reverse(x.begin(),x.end());
    	reverse(y.begin(),y.end());
    	double ans=0;
    	double inda=0,indb=0;
	a=0,b=0;
	while(inda<=n&&indb<=n)
	{
	    if(a<b&&inda<n)
		{
			a+=x[inda];
			inda++;
		}
		else
		{
			b+=y[indb];
			indb++;
		}
		//cout<<inda<<' '<<indb<<endl;
	    ans=max(ans,min(a-inda-indb,b-inda-indb));
	}
    	printf("%.4lf",(double)ans);
       	//THIS IS IS THE END
    }
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 15 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 3 ms 384 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 384 KB Output is correct
16 Correct 3 ms 384 KB Output is correct
17 Correct 88 ms 2736 KB Output is correct
18 Correct 85 ms 2916 KB Output is correct
19 Correct 82 ms 2920 KB Output is correct
20 Correct 83 ms 2924 KB Output is correct
21 Correct 91 ms 3228 KB Output is correct
22 Correct 84 ms 3032 KB Output is correct
23 Correct 88 ms 2912 KB Output is correct
24 Correct 85 ms 2948 KB Output is correct
25 Correct 89 ms 3056 KB Output is correct
26 Correct 90 ms 3168 KB Output is correct