답안 #485126

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
485126 2021-11-06T09:52:39 Z hammer23 Balloons (CEOI11_bal) C++14
20 / 100
172 ms 6340 KB
#include <bits/stdc++.h>
using namespace std;

/*******  All Required define Pre-Processors and typedef Constants *******/
typedef pair<int,int> pii;
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sz(x) (int)(x).size()
#define all(x) x.begin(),x.end()
#define sor(x) sort(all(x))
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pb push_back
#define eb emplace_back
#define pf push_front
#define ll long long
#define numBit(x) __builtin_popcount(x)
#define lb lower_bound
#define ub upper_bound
#define ar array
#define endl '\n'
#define fi first
#define se second

const int inf = 1e9+1;
const int maxN = 2e5 + 1;
const int MOD = 1e9 + 7;

using namespace std;
 ll powmod(ll a, ll b, ll p){
    a %= p;
    if (a == 0) return 0;
    ll product = 1;
    while(b > 0){
        if (b&1){
            product *= a;
            product %= p;
            --b;
        }
        a *= a;
        a %= p;
        b /= 2;
    }
    return product;
}
 ll inv(ll a, ll p){
    return powmod(a, p-2, p);
}

 ll DIVMOD(ll a, ll b, ll p){
    // A*(B^(MOD-2))%MOD
    return a*inv(b,p)%p;
}
void file(const string FILE = "bongbong") {
    //freopen((FILE + ".INP").c_str(), "r", stdin);
    //freopen((FILE + ".OUT").c_str(), "w", stdout);
}

int n;
int x[maxN];
double r[maxN];
void solve(){
    stack<int> st;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x[i]>>r[i];
    }

    for(int i=0;i<n;i++){
        while(!st.empty()){
            int j=st.top();
            r[i]=min(r[i],((x[i]-x[j])*(x[i]-x[j]))/(4*r[j]));
            if(r[j]>r[i]) break;
            else st.pop();
        }
        st.push(i);
        //cout<<ans<<setprecision(3)<<endl;
        printf("%.3f \n", r[i]);
    }
}

int main()
{
    //file();
    fastIO;
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 332 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952'
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB 505 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 348 KB 506th numbers differ - expected: '365.0000000000', found: '-2481854.0649999999', error = '2482219.0649999999'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 880 KB 655th numbers differ - expected: '591.0000000000', found: '-2402336.3029999998', error = '2402927.3029999998'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 1504 KB 4th numbers differ - expected: '15396.0000000000', found: '-8148.5510000000', error = '23544.5510000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 97 ms 3020 KB 7234th numbers differ - expected: '7160.0000000000', found: '-2398141.9989999998', error = '2405301.9989999998'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 95 ms 3456 KB 4643rd numbers differ - expected: '2427.0000000000', found: '-2355611.7020000000', error = '2358038.7020000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 134 ms 4440 KB 1734th numbers differ - expected: '1856.0220000000', found: '-2324667.3859999999', error = '2326523.4079999998'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 172 ms 6340 KB 2723rd numbers differ - expected: '859.0470000000', found: '-2333711.4849999999', error = '2334570.5319999997'
2 Halted 0 ms 0 KB -