Submission #238944

# Submission time Handle Problem Language Result Execution time Memory
238944 2020-06-13T16:59:47 Z dolphingarlic Balloons (CEOI11_bal) C++14
100 / 100
184 ms 3908 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,pow(x-s.top().first,2)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%f\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,pow(x-s.top().first,2)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%f\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,pow(x-s.top().first,2)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%f\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,pow(x-s.top().first,2)/s.top().second/4);if(r>s.top().second)s.pop();else break;}s.push({x,r});printf("%f\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 22 ms 512 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 49 ms 1144 KB 50000 numbers
2 Correct 44 ms 1144 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 115 ms 1912 KB 115362 numbers
2 Correct 93 ms 2424 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 154 ms 2296 KB 154271 numbers
2 Correct 162 ms 3908 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 184 ms 2556 KB 200000 numbers
2 Correct 155 ms 3832 KB 199945 numbers