답안 #543198

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
543198 2022-03-29T18:47:48 Z perchuts Balloons (CEOI11_bal) C++17
10 / 100
191 ms 7080 KB
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define endl '\n'
#define pb push_back
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ii = pair<int,int>;
using iii = tuple<int,int,int>;

const int inf = 2e9+1;
const int mod = 1e9+7;
const int maxn = 2e5+100;

template<typename X, typename Y> bool ckmin(X& x, const Y& y) { return (y < x) ? (x=y,1):0; }
template<typename X, typename Y> bool ckmax(X& x, const Y& y) { return (x < y) ? (x=y,1):0; }

double v[maxn], r[maxn], resp[maxn];

double compute(int i,int j){
    return min((v[i]-v[j])*(v[i]-v[j])/(4*resp[j]),r[i]);
}


int main(){_
    int n;cin>>n;
    for(int i=1;i<=n;++i)cin>>v[i]>>r[i];
    stack<int>st;
    for(int i=1;i<=n;++i){
        while(!st.empty()&&compute(i,st.top())>resp[st.top()])st.pop();
        resp[i] = (st.empty()?r[i]:compute(i,st.top()));
        st.push(i);
    }
    for(int i=1;i<=n;++i)cout<<fixed<<setprecision(3)<<resp[i]<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB 10 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB 14th numbers differ - expected: '2.6090000000', found: '7.1410000000', error = '4.5320000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB 79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 21 ms 1088 KB 137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 53 ms 2328 KB 250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 106 ms 4048 KB 162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 130 ms 4660 KB 510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 164 ms 5736 KB 161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 191 ms 7080 KB 248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000'
2 Halted 0 ms 0 KB -