답안 #121144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121144 2019-06-26T07:07:32 Z MvC Sure Bet (CEOI17_sure) C++11
0 / 100
2 ms 304 KB
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include<bits/stdc++.h>
//#include "teams.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<62);
const int inf=(1<<30);
const ll nmax=1e3+50;
const int mod=1e9+7;
using namespace std;
int n,i,j;
double a[nmax],b[nmax],p[nmax],s[nmax],ans;
int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	cin>>n;
	for(i=1;i<=n;i++)cin>>a[i]>>b[i];
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	reverse(a+1,a+n+1);
	reverse(b+1,b+n+1);
	for(i=1;i<=n;i++)p[i]=p[i-1]+a[i];
	for(i=1;i<=n;i++)s[i]=s[i-1]+b[i];
	for(i=1;i<=2*n;i++)
	{
		for(j=0;j<=min(i,n);j++)
		{
			if(i-j>n || i-j<0)continue;
			ans=max(ans,min(p[j],s[i-j])-i);
		}
	}
	cout<<fixed<<setprecision(10)<<ans<<endl;
	return 0;
}

Compilation message

sure.cpp:2:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("O3")
 
sure.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
 #pragma GCC optimization("unroll-loops")
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -