제출 #703214

#제출 시각아이디문제언어결과실행 시간메모리
703214a_aguiloBalloons (CEOI11_bal)C++14
100 / 100
524 ms9548 KiB
#include<bits/stdc++.h> using namespace std; int n; long double getRad(long double d, long double r){ long double result = (long double)d*((long double)d/(4*r)); return result; } int main(){ cin >> n; long double radius[n]; int position[n]; for(int i = 0; i < n; ++i) cin >> position[i] >> radius[i]; stack<pair<int, long double>> MyStack; MyStack.push({position[0], radius[0]}); for(int i = 1; i < n; ++i){ int lastIdx = MyStack.size()-1; radius[i] = min(radius[i], getRad(position[i]-MyStack.top().first, MyStack.top().second)); while(!MyStack.empty() and radius[i] >= MyStack.top().second){ MyStack.pop(); if(!MyStack.empty()) radius[i] = min(radius[i], getRad(position[i]-MyStack.top().first, MyStack.top().second)); } MyStack.push({position[i], radius[i]}); } for(int i = 0; i < n; ++i){ cout << fixed << setprecision(3) << radius[i] << endl; } return 0; }

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

bal.cpp: In function 'int main()':
bal.cpp:20:7: warning: unused variable 'lastIdx' [-Wunused-variable]
   20 |   int lastIdx = MyStack.size()-1;
      |       ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...