Submission #575144

#TimeUsernameProblemLanguageResultExecution timeMemory
575144alexz1205Balloons (CEOI11_bal)C++14
100 / 100
556 ms15244 KiB
#include <iostream> #include <iomanip> #include <vector> using namespace std; typedef long double lint; lint dist(lint p1, lint p2, lint r1){ return (p1-p2)*(p1-p2)/4/r1; } int main() { int n; cin >> n; lint pos[n], maxr[n], rad[n]; for (int x = 0; x < n; x ++){ cin >> pos[x] >> maxr[x]; } vector<int> stack; for (int x = 0; x < n; x ++){ rad[x] = maxr[x]; while (!stack.empty()){ int y = stack.back(); rad[x] = min(dist(pos[y], pos[x], rad[y]), rad[x]); if (rad[x] > rad[y]){ stack.pop_back(); }else { break; } } stack.push_back(x); } for (int x = 0; x < n; x ++){ cout << fixed << setprecision(3) << rad[x] << 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...