제출 #1222935

#제출 시각아이디문제언어결과실행 시간메모리
1222935iamhereforfunBalloons (CEOI11_bal)C++20
20 / 100
113 ms8276 KiB
// IamHereForFun // #include <bits/stdc++.h> using namespace std; #define LSOne(X) ((X) & -(X)) const int N = 2e5 + 5; const int M = 15; const int C = 26; const int LG = 20; const int R = 25e3 + 5; const int B = 100; const int O = 3e5 + 5; const int INF = 1e9 + 5; const int MOD = 998244353; const int nx[] = {0, 1, 0, -1}, ny[] = {1, 0, -1, 0}; int n; long double rad[N], d[N]; vector<pair<long double, int>> stk; // rad, id long double val(long double x, pair<long double, int> p) { int id = p.second; return (x - d[id])*(x - d[id])/4/p.first; } void solve() { cin >> n; for (int x = 0; x < n; x++) { long double c, r; cin >> c >> r; d[x] = c; while(stk.size() > 1) { if(val(c, stk[stk.size() - 2]) < val(c, stk[stk.size() - 1])) stk.pop_back(); else break; } if(stk.empty()) { rad[x] = r; stk.push_back({rad[x], x}); } else { rad[x] = min(val(c, stk.back()), r); // cout << stk.back().first << " " << stk.back().second << " " << x << "\n"; while(!stk.empty()) { if(stk.back().first < rad[x]) stk.pop_back(); else break; } stk.push_back({rad[x], x}); } } for (int x = 0; x < n; x++) { cout << fixed << setprecision(3) << rad[x] << "\n"; } } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; for (int x = 1; x <= t; x++) { solve(); } 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...