Submission #238943

# Submission time Handle Problem Language Result Execution time Memory
238943 2020-06-13T16:58:36 Z dolphingarlic Balloons (CEOI11_bal) C++14
100 / 100
186 ms 3448 KB
#include <bits/stdc++.h>
main(){int n;std::stack<std::pair<double,double>>s;scanf("%d",&n);while(n--){double x,r;scanf("%lf %lf",&x,&r);while(s.size()){r=std::min(r,(x-s.top().first)*(x-s.top().first)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%.3f\n",r);}}

Compilation message

bal.cpp:2:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){int n;std::stack<std::pair<double,double>>s;scanf("%d",&n);while(n--){double x,r;scanf("%lf %lf",&x,&r);while(s.size()){r=std::min(r,(x-s.top().first)*(x-s.top().first)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%.3f\n",r);}}
      ^
bal.cpp: In function 'int main()':
bal.cpp:2:57: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 main(){int n;std::stack<std::pair<double,double>>s;scanf("%d",&n);while(n--){double x,r;scanf("%lf %lf",&x,&r);while(s.size()){r=std::min(r,(x-s.top().first)*(x-s.top().first)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%.3f\n",r);}}
                                                    ~~~~~^~~~~~~~~
bal.cpp:2:94: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 main(){int n;std::stack<std::pair<double,double>>s;scanf("%d",&n);while(n--){double x,r;scanf("%lf %lf",&x,&r);while(s.size()){r=std::min(r,(x-s.top().first)*(x-s.top().first)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%.3f\n",r);}}
                                                                                         ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 6 ms 384 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 21 ms 768 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1272 KB 50000 numbers
2 Correct 42 ms 1268 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 96 ms 1656 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 112 ms 1784 KB 115362 numbers
2 Correct 93 ms 2296 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 146 ms 2040 KB 154271 numbers
2 Correct 156 ms 3448 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 186 ms 2272 KB 200000 numbers
2 Correct 154 ms 3448 KB 199945 numbers