Submission #757534

#TimeUsernameProblemLanguageResultExecution timeMemory
757534taitruong270Balloons (CEOI11_bal)C++17
100 / 100
192 ms5120 KiB
/*============================================================================================================== __ __ _____ ______ _______ | | | | / __ \ / _____| / ______| __| |__ __| |__ |_| | | | | | | |__| __| |__| __| | | | |____ | |_____ | | _____ _ | | ____ __ __ ____ _____ _____ / / \ ___ \ | ___ \ | | / _ \ | | | | / _/ | | | | / _ \ / __ \ / _ \ / / | | | | | | | |_ | |_| | | | | |_ | | | |_| | | |_| | | | | | | |_| | / /___ ____| | | |___| | \____\ \____/| |_| \____\ |_| \_____/ \_____/ |_| |_| \____ | |______| |______/ \_______/ | | __/ | |___/ Pratice, practice, and practice I hated every minute of training, but I said, ‘Don’t quit. Suffer now and live the rest of your life as a champion.' - Mohamed Ali You may not be the best, but must be the most effort Noi dau + Suy ngam = Tien bo ==============================================================================================================*/ #include <bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' const ll mod = 1e9+7; ll n; double x[200005], r[200005]; double dist(pair<double, double> a, pair<double, double> b) { return (a.first-b.first)*(a.first-b.first)/(4.0*a.second); } void solve() { cin>>n; for (ll i=1; i<=n; i++) cin>>x[i]>>r[i]; stack<pair<double, double>> st; for (ll i=1; i<=n; i++) { double max_r=r[i]; while (!st.empty()) { pair<double, double> lst=st.top(); max_r=min(max_r, dist(lst, {x[i], r[i]})); if (max_r>=lst.second) st.pop(); else break; } cout<<fixed<<setprecision(3)<<max_r<<endl; st.push({x[i], max_r}); } } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); clock_t start = clock(); solve(); clock_t end = clock(); cerr<<"Time: "<<fixed<<setprecision(10)<<double(end-start)/double(CLOCKS_PER_SEC)<<"\n"; 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...