답안 #61714

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61714 2018-07-26T12:17:08 Z IvanC Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 5368 KB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1e5 + 10;

double A[MAXN],B[MAXN],pref_A[MAXN],pref_B[MAXN];
int N;

double calcula(int x,int y){
	return min(pref_A[x],pref_B[y]) - (x + y);
}

bool compara(double a,double b){
	return a > b;
}

int main(){

	double ans = 0.0;
	scanf("%d",&N);
	for(int i = 1;i<=N;i++){
		scanf("%lf %lf",&A[i],&B[i]);
	}
	sort(A+1,A+N+1,compara);
	sort(B+1,B+N+1,compara);
	for(int i = 1;i<=N;i++){
		pref_A[i] = pref_A[i-1] + A[i];
		pref_B[i] = pref_B[i-1] + B[i];
	}

	for(int a = 0;a<=N;a++){
		for(int b = 0;b<=N;b++){
			ans = max(ans, calcula(a,b) );
		}
	}

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

	return 0;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&N);
  ~~~~~^~~~~~~~~
sure.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lf %lf",&A[i],&B[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 3 ms 648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 3 ms 648 KB Output is correct
7 Correct 2 ms 648 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 3 ms 768 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 7 ms 768 KB Output is correct
13 Correct 5 ms 776 KB Output is correct
14 Correct 6 ms 812 KB Output is correct
15 Correct 7 ms 824 KB Output is correct
16 Correct 7 ms 912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 3 ms 360 KB Output is correct
3 Correct 3 ms 472 KB Output is correct
4 Correct 2 ms 476 KB Output is correct
5 Correct 2 ms 516 KB Output is correct
6 Correct 3 ms 648 KB Output is correct
7 Correct 2 ms 648 KB Output is correct
8 Correct 2 ms 648 KB Output is correct
9 Correct 3 ms 768 KB Output is correct
10 Correct 3 ms 768 KB Output is correct
11 Correct 3 ms 768 KB Output is correct
12 Correct 7 ms 768 KB Output is correct
13 Correct 5 ms 776 KB Output is correct
14 Correct 6 ms 812 KB Output is correct
15 Correct 7 ms 824 KB Output is correct
16 Correct 7 ms 912 KB Output is correct
17 Execution timed out 2100 ms 5368 KB Time limit exceeded
18 Halted 0 ms 0 KB -