답안 #126997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
126997 2019-07-08T18:44:01 Z Lawliet Sure Bet (CEOI17_sure) C++14
0 / 100
2 ms 256 KB
#include <bits/stdc++.h>
 
#define MAX 1010
 
using namespace std;
 
int n;
 
double ans = -4000000.0;
 
double a[MAX];
double b[MAX];
 
int main()
{
	scanf("%d",&n);
 
	for(int g = 1 ; g <= n ; g++)
		scanf("%lf %lf",&a[g],&b[g]);
 
	sort(a + 1 , a + n + 1);
	sort(b + 1 , b + n + 1);
 
	double sumA, sumB;
 
	sumA = 0;

	//printf("-> %lf\n",b[1] + b[2] + b[3] + b[4]);
 
	for(int qtdA = 0 ; qtdA <= n ; qtdA++)
	{
		sumA += a[ n - qtdA + 1 ];
		sumB = 0;
 
		for(int qtdB = 0 ; qtdB <= n ; qtdB++)
		{
			if(qtdA == 0 && qtdB == 0) continue;

			//printf("ooooooooo %lf  + %lf     = %lf\n",sumB,b[n - qtdB + 1],sumB + b[n - qtdB + 1]);

			sumB = sumB + b[ n - qtdB + 1 ];

			//printf("A %d  %lf     B %d  %lf     %lf     %lf\n",qtdA,sumA,qtdB,sumB,b[n - qtdB + 1],min(sumA , sumB) - qtdA - qtdB);
 
			ans = max(ans , min(sumA , sumB) - qtdA - qtdB);
		}
	}
 
	printf("%.4lf\n",ans);
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);
  ~~~~~^~~~~~~~~
sure.cpp:19:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf %lf",&a[g],&b[g]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -