Submission #970481

# Submission time Handle Problem Language Result Execution time Memory
970481 2024-04-26T15:37:08 Z Aiperiii Balloons (CEOI11_bal) C++14
100 / 100
264 ms 5528 KB
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
    ios_base::sync_with_stdio();
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector <pair <ld,ld> > pr;
    for(int i=0;i<n;i++){
        ld x,r;
        cin>>x>>r;
        while(!pr.empty()){
            ld x1=pr.back().ff;
            ld r1=pr.back().ss;
            r=min(r,(x-x1)*(x-x1)/(4*r1));
            if(r1<=r)pr.pop_back();
            else break;
        }
        cout<<fixed<<setprecision(3)<<r<<"\n";
        pr.pb({x,r});
    }
}
/*
 
3
0 9
8 1
13 7
 
*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 3 ms 344 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 27 ms 604 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1992 KB 50000 numbers
2 Correct 61 ms 1616 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 123 ms 2996 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 141 ms 3528 KB 115362 numbers
2 Correct 146 ms 3572 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 196 ms 4224 KB 154271 numbers
2 Correct 264 ms 5476 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 261 ms 4908 KB 200000 numbers
2 Correct 242 ms 5528 KB 199945 numbers