Submission #948275

#TimeUsernameProblemLanguageResultExecution timeMemory
948275AmaarsaaBalloons (CEOI11_bal)C++14
100 / 100
109 ms5532 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long ; double Find_r(double x1, double r1, double x2) { x1 = x1 - x2; x1 = x1 * x1; x1 = x1 / (4.0 * r1); return x1; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); ll t, x, r, max_r; cin >> t; stack < pair < double , double > > st; while ( t --) { double r, max_r; cin >> x >> r; max_r = r; while (!st.empty()) { pair < double , double > R =st.top(); max_r = min(max_r, Find_r(R.first, R.second, x)); if ( R.second <= max_r) st.pop(); else break; } printf("%.3lf\n", max_r); st.push({x, max_r}); } }

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:16:11: warning: unused variable 'r' [-Wunused-variable]
   16 |  ll t, x, r, max_r;
      |           ^
bal.cpp:16:14: warning: unused variable 'max_r' [-Wunused-variable]
   16 |  ll t, x, r, max_r;
      |              ^~~~~
#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...