제출 #703050

#제출 시각아이디문제언어결과실행 시간메모리
703050a_aguiloBalloons (CEOI11_bal)C++14
20 / 100
541 ms9524 KiB
#include<bits/stdc++.h> using namespace std; int n; long double getRad(int d, long double r){ long double result = (long double)(d*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]; vector<pair<int, long double>> MyStack; MyStack.reserve(n); MyStack.push_back({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[lastIdx].first, MyStack[lastIdx].second)); while(lastIdx>= 0 and radius[i] > MyStack[lastIdx].second){ MyStack.pop_back(); lastIdx = MyStack.size()-1; if(lastIdx>= 0) radius[i] = min(radius[i], getRad(position[i]-MyStack[lastIdx].first, MyStack[lastIdx].second)); } MyStack.push_back({position[i], radius[i]}); } for(int i = 0; i < n; ++i){ cout << radius[i] << endl; } return 0; }
#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...