답안 #738109

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
738109 2023-05-08T07:35:45 Z Toxtaq Balloons (CEOI11_bal) C++17
컴파일 오류
0 ms 0 KB
#include<iostream>#include<vector>#include<algorithm>#include<numeric>#include<complex>#include<map>#include<iomanip>using namespace std;#define eps 1e-6int n;vector<pair<int, double>>balloons;vector<double>res;double dist(pair<int, double>a,pair<int,double>b){	return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));}bool check(double mid, int indx){	for(int i = indx-1;i>=0;--i){		if(dist({balloons[i].first, res[i]},{balloons[indx].first, mid})-(res[i]+mid)< eps)return true;	}	return false;}int main(){	cin >> n;	balloons.resize(n);	for(int i = 0;i<n;++i){		cin >> balloons[i].first >> balloons[i].second;	}	res.resize(n);	res[0]=balloons[0].second;	for(int i = 1;i<n;++i){		double l = 1, r = balloons[i].second;		while(r-l>eps){			double mid = (l+r)/2;			if(check(mid, i)){				r = mid;			}			else l = mid;		}		res[i]=l;	}	for(double i : res)cout << fixed << setprecision(3)<< i << '\n';}

Compilation message

bal.cpp:1:19: warning: extra tokens at end of #include directive
    1 | #include<iostream>#include<vector>#include<algorithm>#include<numeric>#include<complex>#include<map>#include<iomanip>using namespace std;#define eps 1e-6int n;vector<pair<int, double>>balloons;vector<double>res;double dist(pair<int, double>a,pair<int,double>b){ return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));}bool check(double mid, int indx){ for(int i = indx-1;i>=0;--i){  if(dist({balloons[i].first, res[i]},{balloons[indx].first, mid})-(res[i]+mid)< eps)return true; } return false;}int main(){ cin >> n; balloons.resize(n); for(int i = 0;i<n;++i){  cin >> balloons[i].first >> balloons[i].second; } res.resize(n); res[0]=balloons[0].second; for(int i = 1;i<n;++i){  double l = 1, r = balloons[i].second;  while(r-l>eps){   double mid = (l+r)/2;   if(check(mid, i)){    r = mid;   }   else l = mid;  }  res[i]=l; } for(double i : res)cout << fixed << setprecision(3)<< i << '\n';}
      |                   ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/10/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status