답안 #485133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
485133 2021-11-06T10:15:45 Z hammer23 Balloons (CEOI11_bal) C++17
0 / 100
437 ms 10256 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];
long double r[maxN],pck[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++){
        pck[i]=r[i];
        while(!st.empty()){
            int j=st.top();
            pck[i]=min(pck[i],min(r[i],((x[i]-x[j])*(x[i]-x[j]))/(4.0*pck[j])));
            if(r[i]>=r[j]) st.pop();
            else break;
        }
        st.push(i);
        //cout<<ans<<setprecision(3)<<endl;
        printf("%.3Lf \n", pck[i]);
    }
}

int main()
{
    //file();
    fastIO;
    int t=1;
    //cin>>t;
    while(t--)
        solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 332 KB 5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB 5th numbers differ - expected: '0.1170000000', found: '1.0000000000', error = '0.8830000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 332 KB 148th numbers differ - expected: '8.2380000000', found: '26.0000000000', error = '17.7620000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 17 ms 1276 KB 196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 437 ms 8076 KB 4th numbers differ - expected: '15396.0000000000', found: '-8148.5510000000', error = '23544.5510000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 88 ms 5380 KB 14th numbers differ - expected: '7919.0000000000', found: '-64224.1280000000', error = '72143.1280000000'
# 결과 실행 시간 메모리 Grader output
1 Incorrect 109 ms 6108 KB 7th numbers differ - expected: '5052.0000000000', found: '-85953.8180000000', error = '91005.8180000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 141 ms 7712 KB 25th numbers differ - expected: '1850.0000000000', found: '-263697.1010000000', error = '265547.1010000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 169 ms 10256 KB 28th numbers differ - expected: '2933.0000000000', found: '-177289.5380000000', error = '180222.5380000000'
2 Halted 0 ms 0 KB -