Submission #569868

#TimeUsernameProblemLanguageResultExecution timeMemory
569868Karnis_052Balloons (CEOI11_bal)C++17
100 / 100
539 ms7032 KiB
// Bismillahir Rahmanir Rahim #include<bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int>PI; typedef pair<ll, ll > PL; typedef vector<int>VI; typedef vector<ll>VL; #define FF first #define SS second const int mod = 1e9 + 7; const int INF = 1e9; const int N = 1e5 + 5; // it's a oj.uz problem int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; stack < pair<double, double>>st; for (int i = 0; i < n; i++) { long double x, r; cin >> x >> r; while (!st.empty()) { long double x1 = st.top().FF, r1 = st.top().SS; long double nw = (x1 - x) * (x1 - x) / (4 * r1); r = min(r, nw); if (r >= r1) st.pop(); else break; } st.push({x, r}); cout << fixed << setprecision(3); cout << r << endl; } cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << 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...