Submission #703115

#TimeUsernameProblemLanguageResultExecution timeMemory
703115a_aguiloBalloons (CEOI11_bal)C++14
30 / 100
521 ms6464 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]; 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...