제출 #835344

#제출 시각아이디문제언어결과실행 시간메모리
835344Dyzio96Balloons (CEOI11_bal)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 +7;
int n;

// pair<int,int> baloon[M];


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	vector<double> radius;
	stack<pair<double ,double >> s;
	// s.push({baloon[0].first,baloon[0].second});
	double  max_r;
	for (int i = 0;  i <n;i++){
		double a, x;
		cin >> a >> x;
		max_r = x;
		// max_r= ((a - s.top().first) *   (a - s.top().first))/4 * s.top().second;
		while(!s.empty()){
			double  last_r= ((a - s.top().first) *   (a - s.top().first))/4 * s.top().second;
			max_r = max(last_r,max_r);
			if ( max_r > s.top().second){
				s.pop();
				continue;
			}
			else {
				break
			}
			s.push({a,max_r});
			radius[i] = max_r;
		}
	}
	for (double &r: radius) {cout << r << ;\n;}
	
}

컴파일 시 표준 에러 (stderr) 메시지

bal.cpp:36:41: error: stray '\' in program
   36 |  for (double &r: radius) {cout << r << ;\n;}
      |                                         ^
bal.cpp: In function 'int main()':
bal.cpp:30:10: error: expected ';' before '}' token
   30 |     break
      |          ^
      |          ;
   31 |    }
      |    ~      
bal.cpp:36:40: error: expected primary-expression before ';' token
   36 |  for (double &r: radius) {cout << r << ;\n;}
      |                                        ^
bal.cpp:36:42: warning: statement has no effect [-Wunused-value]
   36 |  for (double &r: radius) {cout << r << ;\n;}
      |                                          ^