Submission #410673

# Submission time Handle Problem Language Result Execution time Memory
410673 2021-05-23T10:14:19 Z snasibov05 Prosjek (COCI18_prosjek) C++14
50 / 50
1 ms 300 KB
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main() {

    int n; cin >> n;
    multiset<double> st;
    for (int i = 0; i < n; ++i){
        int x; cin >> x;
        st.insert(x*1.0);
    }

    while (st.size() > 1){
        auto it1 = st.begin();
        auto it2 = ++st.begin();

        double k = (*it1 + *it2) / 2.0;
        st.erase(it1);
        st.erase(it2);
        st.insert(k);
    }

    double ans = *st.begin();
    cout.precision(6);
    cout << fixed << ans << "\n";

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct