답안 #121323

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121323 2019-06-26T10:23:52 Z killB0x Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 384 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)
		{
			a+=x[inda];
			inda++;
		}
		else
		{
			b+=y[indb];
			indb++;
		}
		cout<<a<<' '<<b<<endl;
	    ans=max(ans,min(a-inda-indb,b-inda-indb));
	}
    	printf("%.4lf",(double)ans);
       	//THIS IS IS THE END
    }
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -