답안 #447455

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
447455 2021-07-26T11:23:04 Z fuad27 Sure Bet (CEOI17_sure) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
#define double long double
int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	long long n,Ai=0,Bi=0;cin>>n;
	long double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
	for(int i=0;i<n;i++)cin>>a[i]>>b[i];
	sort(a,a+n);sort(b,b+n);
	reverse(a,a+n);reverse(b,b+n);
	while(Ai<=n && Bi<=n) {
		if(sB<sA)sB+=b[Bi],Bi++;
		else sA+=a[Ai],Ai++;
		ans = max(ans,min(sA-Ai-Bi,sB-Ai-Bi));
	}
	cout.precision(4);
	cout<<fixed<<ans;
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:3:16: error: 'long long' specified with 'double'
    3 | #define double long double
      |                ^~~~
sure.cpp:9:7: note: in expansion of macro 'double'
    9 |  long double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
      |       ^~~~~~
sure.cpp:3:16: error: 'long long' specified with 'double'
    3 | #define double long double
      |                ^~~~
sure.cpp:9:7: note: in expansion of macro 'double'
    9 |  long double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
      |       ^~~~~~
sure.cpp:3:16: error: 'long long' specified with 'double'
    3 | #define double long double
      |                ^~~~
sure.cpp:9:7: note: in expansion of macro 'double'
    9 |  long double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
      |       ^~~~~~
sure.cpp:3:16: error: 'long long' specified with 'double'
    3 | #define double long double
      |                ^~~~
sure.cpp:9:7: note: in expansion of macro 'double'
    9 |  long double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
      |       ^~~~~~
sure.cpp:3:16: error: 'long long' specified with 'double'
    3 | #define double long double
      |                ^~~~
sure.cpp:9:7: note: in expansion of macro 'double'
    9 |  long double ans=0.0,sA=0.0,sB=0.0,a[n+1],b[n+1];
      |       ^~~~~~