제출 #485105

#제출 시각아이디문제언어결과실행 시간메모리
485105largefenceBalloons (CEOI11_bal)C++17
100 / 100
144 ms6448 KiB
#include <bits/stdc++.h> using namespace std; #define pw2(x) ((x)*(x)) double x[200000], r[200000], pck[200000]; int main() { //ios::sync_with_stdio(false); //cin.tie(0); //freopen("ws.INP", "r", stdin); //freopen("ws.OUT", "w", stdout); int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%lf %lf", &x[i], &r[i]);//cin >> x[i] >> r[i]; pck[0] = r[0]; printf("%.3lf\n", pck[0]); stack<int> st; st.push(0); for (int i = 1; i < n; i++) { pck[i] = r[i]; /* if distance between 2 center < sum of rad of circles => intersect ^ <=> sqrt((x[i] - x[j])^2 + (h[i] - h[j])^2) == h[i] + h[j] => maximal */ while (!st.empty()) { int j = st.top(); double res = pw2(x[i] - x[j]) / (4.0 * pck[j]); pck[i] = min(pck[i], min(r[i], res)); if (pck[i] >= pck[j]) st.pop(); else break; } st.push(i); printf("%.3lf\n", pck[i]); } return 0; } // How to AC ?

컴파일 시 표준 에러 (stderr) 메시지

bal.cpp: In function 'int main()':
bal.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  int n; scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
bal.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lf %lf", &x[i], &r[i]);//cin >> x[i] >> r[i];
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...