답안 #126972

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
126972 2019-07-08T17:21:31 Z Lawliet Sure Bet (CEOI17_sure) C++14
20 / 100
2 ms 504 KB
#include <bits/stdc++.h>

#define MAX 1010

using namespace std;

int n;

float ans = -1.0;

float a[MAX];
float b[MAX];

int main()
{
	scanf("%d",&n);

	for(int g = 1 ; g <= n ; g++)
		scanf("%f %f",&a[g],&b[g]);

	sort(a + 1 , a + n + 1);
	sort(b + 1 , b + n + 1);

	float sumA, sumB;

	sumA = 0;

	for(int qtdA = 0 ; qtdA <= n ; qtdA++)
	{
		sumA += a[ n - qtdA + 1 ];
		sumB = 0;

		for(int qtdB = 0 ; qtdB <= n ; qtdB++)
		{
			sumB += b[ n - qtdB + 1 ];

			ans = max(ans , min(sumA , sumB) - qtdA - qtdB);
		}
	}

	printf("%.4f\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("%f %f",&a[g],&b[g]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Halted 0 ms 0 KB -