Submission #356778

#TimeUsernameProblemLanguageResultExecution timeMemory
356778jnkBalloons (CEOI11_bal)C++17
0 / 100
297 ms9452 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; double x[200005], r[200005], res[200005]; int main(){ cout.sync_with_stdio(0); cin.tie(0); int n; cin >> n; for(int i = 0; i < n; i++) cin >> x[i] >> r[i]; res[0] = r[0]; stack<pair<double,double>> st; st.push(make_pair(x[0], res[0])); for(int i = 1; i < n; i++){ double esq = 0, dir = r[i]; for(int j = 0; j < 50; j++){ double r = (esq + dir)/2; int ok = 1; while(!st.empty()){ auto p = st.top(); double xdif = x[i] - p.first; double ydif = r - p.second; double dist = r+p.second; if(xdif*xdif + ydif*ydif < dist*dist) ok = 0; if(r > p.second) st.pop(); else break; } if(ok) esq = r; else dir = r; } res[i] = esq; st.push(make_pair(x[i], res[i])); } for(int i = 0; i < n; i++) printf("%.3f\n", res[i]); return 0; }

Compilation message (stderr)

bal.cpp: In function 'int main()':
bal.cpp:42:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   42 |     for(int i = 0; i < n; i++)
      |     ^~~
bal.cpp:45:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   45 |  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...