Submission #578780

# Submission time Handle Problem Language Result Execution time Memory
578780 2022-06-18T00:17:30 Z DanielQiu Balloons (CEOI11_bal) C++17
100 / 100
466 ms 4784 KB
#include <bits/stdc++.h>
using namespace std;
#define r first
#define x second
int main(){
        //freopen("test.in", "r", stdin);
        int n;
        cin>>n;
        stack<pair<long double, long double>> rd;//{radius, x coord}
        for(int i = 0; i<n; i++){
                int x, r;
                cin>>x>>r;
                long double cur = r;
                while(!rd.empty()){
                        long double dist= (rd.top().x-x)*(rd.top().x-x)/(4*rd.top().r);
                        cur = min(cur, dist);
                        if(cur>rd.top().r){
                                rd.pop();
                        }else{
                                break;
                        }
                }
                rd.push({cur, x});
                printf("%.3Lf\n",cur);
        }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 5 ms 212 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 46 ms 392 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 125 ms 1076 KB 50000 numbers
2 Correct 121 ms 1448 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 239 ms 1408 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 264 ms 1588 KB 115362 numbers
2 Correct 277 ms 2936 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 351 ms 1776 KB 154271 numbers
2 Correct 466 ms 4708 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 463 ms 2040 KB 200000 numbers
2 Correct 451 ms 4784 KB 199945 numbers