답안 #303039

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
303039 2020-09-19T19:20:25 Z Kenzo_1114 Sure Bet (CEOI17_sure) C++17
20 / 100
51 ms 768 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100010;

int n, m[20];
double a[MAXN], b[MAXN], ans;

void BKT(int id)
{
	if(id == n)
	{
		double sa = 0.0000, sb = 0.0000;
		for(int i = 0; i < n; i++)
		{	
			if(m[i] == 0)	continue;

			if(m[i] == 1 || m[i] == 3)	sa += a[i] - 1, sb--;
			if(m[i] == 2 || m[i] == 3)	sb += b[i] - 1, sa--;

			ans = max(ans, min(sa, sb));
		}

		return;
	}

	for(int i = 0; i < 4; i++)	
	{
		m[id] = i;
		BKT(id + 1);
	}
}

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

	for(int i = 0; i < n; i++)
		scanf("%lf %lf", &a[i], &b[i]);

	BKT(0);

	printf("%.4lf\n", (double) ans);
}

/*
	
4
1.4 3.7
1.2 2
1.6 1.4 
1.9 1.5

*/

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:35:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   35 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
sure.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   38 |   scanf("%lf %lf", &a[i], &b[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 49 ms 256 KB Output is correct
4 Correct 51 ms 376 KB Output is correct
5 Correct 50 ms 384 KB Output is correct
6 Correct 50 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 49 ms 256 KB Output is correct
4 Correct 51 ms 376 KB Output is correct
5 Correct 50 ms 384 KB Output is correct
6 Correct 50 ms 256 KB Output is correct
7 Runtime error 1 ms 768 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 49 ms 256 KB Output is correct
4 Correct 51 ms 376 KB Output is correct
5 Correct 50 ms 384 KB Output is correct
6 Correct 50 ms 256 KB Output is correct
7 Runtime error 1 ms 768 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -