Submission #47271489


Source Code Expand

#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <iomanip>
using namespace std;

double rate(vector<pair<double, int>> &P) {
    sort(P.begin(), P.end(), [](auto a, auto b) {
        return a.second < b.second;
    });
    reverse(P.begin(), P.end());

    double rate = 0.0;
    double q = 1;
    double d = 0;
    for (int i = 0; i < P.size(); i++) {
        rate += P[i].first * q;
        d += q;
        q *= 0.9;
    }

    rate /= d;
    rate -= 1200/sqrt(P.size());

    return rate;
}

int main() {
    int N; cin >> N;
    vector<pair<double, int>> P(N);
    for (int i = 0; i < N; i++) {
        int p; cin >> p;
        P.push_back(make_pair(p, i));
    }

    sort(P.begin(), P.end());
    reverse(P.begin(), P.end());

    vector<pair<double, int>> PP;
    double ans = -1000000;
    for (int i = 0; i < N; i++) {
        PP.push_back(P[i]);
        double r = rate(PP);
        if (ans < r) ans = r;
    }

    cout << fixed << setprecision(15);
    cout << ans << endl;

    return 0;
}

Submission Info

Submission Time
Task E - Maximize Rating
User integral
Language C++ 20 (gcc 12.2)
Score 0
Code Size 1109 Byte
Status WA
Exec Time 752 ms
Memory 3912 KiB

Compile Error

Main.cpp: In function ‘double rate(std::vector<std::pair<double, int> >&)’:
Main.cpp:18:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<std::pair<double, int> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   18 |     for (int i = 0; i < P.size(); i++) {
      |                     ~~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 475
Status
AC × 3
AC × 19
WA × 16
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3624 KiB
example_01.txt AC 1 ms 3752 KiB
example_02.txt AC 1 ms 3696 KiB
hand_00.txt AC 80 ms 3860 KiB
hand_01.txt AC 1 ms 3736 KiB
hand_02.txt AC 81 ms 3760 KiB
hand_03.txt AC 752 ms 3880 KiB
hand_04.txt AC 1 ms 3640 KiB
hand_05.txt WA 1 ms 3712 KiB
hand_06.txt AC 80 ms 3912 KiB
random_00.txt WA 319 ms 3756 KiB
random_01.txt WA 302 ms 3840 KiB
random_02.txt WA 4 ms 3832 KiB
random_03.txt AC 1 ms 3764 KiB
random_04.txt AC 1 ms 3704 KiB
random_05.txt WA 312 ms 3760 KiB
random_06.txt WA 311 ms 3912 KiB
random_07.txt WA 4 ms 3748 KiB
random_08.txt AC 1 ms 3720 KiB
random_09.txt AC 1 ms 3760 KiB
random_10.txt WA 311 ms 3756 KiB
random_11.txt WA 308 ms 3796 KiB
random_12.txt WA 4 ms 3700 KiB
random_13.txt AC 1 ms 3716 KiB
random_14.txt AC 1 ms 3724 KiB
random_15.txt WA 255 ms 3832 KiB
random_16.txt WA 286 ms 3860 KiB
random_17.txt WA 4 ms 3776 KiB
random_18.txt AC 1 ms 3792 KiB
random_19.txt AC 1 ms 3752 KiB
random_20.txt WA 205 ms 3860 KiB
random_21.txt WA 175 ms 3744 KiB
random_22.txt WA 3 ms 3756 KiB
random_23.txt AC 1 ms 3680 KiB
random_24.txt AC 1 ms 3632 KiB