답안 #890729

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890729 2023-12-21T19:51:51 Z TimAni Balloons (CEOI11_bal) C++17
10 / 100
2000 ms 6492 KB
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <stack>
#include <queue>
#include <cmath>
#include <array>
#include <iomanip>

using namespace std;

void setIO(string File_name) {
    cin.tie(0)->sync_with_stdio(0);
    if (File_name.size()) {
        freopen((File_name + ".in").c_str(), "r", stdin);
        freopen((File_name + ".out").c_str(), "w", stdout);
    }
}

const long double eps = 1e-9;

void sol() {
    long long n; cin >> n;
    vector<pair<long long, long long>> v(n);
    for(long long i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
    
    deque<long long> mono;
    vector<long double> ans(n);
    auto radius = [&](long long curr, long long prev) -> long double {
        long double r = 1.0 * (v[curr].first - v[prev].first) * ((v[curr].first - v[prev].first)) / (4 * v[prev].second);
        return r;
    };
    auto intersect = [&](long long curr, long long prev) {
        long double y = radius(curr, prev);
        if(v[curr].second >= y) return 1;
        return 0;
    };
    for(long long i = 0; i < n; i++){
        ans[i] = v[i].second;
        for(long long j = i - 1; j >= 0; j--){
            ans[i] = min(ans[i], radius(i, j));
        }
    }
    for(auto el : ans){
        cout << fixed << setprecision(6) << el << ' ';
    }
}

int main() {
    setIO("");
    int T = 1;
    //cin >> T;
    while (T--) sol();
    return 0;
}

Compilation message

bal.cpp: In function 'void sol()':
bal.cpp:39:10: warning: variable 'intersect' set but not used [-Wunused-but-set-variable]
   39 |     auto intersect = [&](long long curr, long long prev) {
      |          ^~~~~~~~~
bal.cpp: In function 'void setIO(std::string)':
bal.cpp:21:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |         freopen((File_name + ".in").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bal.cpp:22:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen((File_name + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 5th numbers differ - expected: '17.1630000000', found: '4.3706900000', error = '12.7923100000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB 2 numbers
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 5th numbers differ - expected: '0.1170000000', found: '0.0833330000', error = '0.0336670000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 344 KB 3rd numbers differ - expected: '121.0000000000', found: '120.0182930000', error = '0.9817070000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 744 ms 1076 KB 3rd numbers differ - expected: '211.0000000000', found: '210.0105630000', error = '0.9894370000'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2048 ms 1884 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2029 ms 3416 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2019 ms 3928 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2063 ms 5204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2035 ms 6492 KB Time limit exceeded
2 Halted 0 ms 0 KB -