Submission #71305159


Source Code Expand

#include <bits/stdc++.h>

#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define int long long
#define ALL(x) (x).begin(), (x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int, int> PI;
typedef pair<int, pair<int, int>> PII;
static const int INF = 1010000000000000017LL;
static const double eps = 1e-12;
static const double pi = 3.14159265358979323846;
static const int dx[4] = {1, -1, 0, 0};
static const int dy[4] = {0, 0, 1, -1};
static const int ddx[8] = {1, -1, 0, 0, 1, 1, -1, -1};
static const int ddy[8] = {0, 0, 1, -1, 1, -1, 1, -1};

template <class T>
inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

int N, M;

signed main() {
    cin >> N >> M;
    vector<vector<double>> X(M);
    for (int i = 0; i < N; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        X[a].push_back(b);
    }
    for (int i = 0; i < M; ++i) {
        int n = X[i].size();
        double res = 0.0;
        for (int j = 0; j < n; ++j) {
            res += X[i][j];
        }
        res = (double)res / (double)n;
        cout << fixed << setprecision(15) << res << endl;
    }
}

Submission Info

Submission Time
Task B - Bird Watching
User tsuyosshi
Language C++23 (GCC 15.2.0)
Score 200
Code Size 1402 Byte
Status AC
Exec Time 1 ms
Memory 3880 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 1
AC × 24
Set Name Test Cases
Sample sample_01.txt
All sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 3772 KiB
test_01.txt AC 1 ms 3704 KiB
test_02.txt AC 1 ms 3772 KiB
test_03.txt AC 1 ms 3772 KiB
test_04.txt AC 1 ms 3752 KiB
test_05.txt AC 1 ms 3772 KiB
test_06.txt AC 1 ms 3876 KiB
test_07.txt AC 1 ms 3876 KiB
test_08.txt AC 1 ms 3728 KiB
test_09.txt AC 1 ms 3772 KiB
test_10.txt AC 1 ms 3768 KiB
test_11.txt AC 1 ms 3656 KiB
test_12.txt AC 1 ms 3728 KiB
test_13.txt AC 1 ms 3728 KiB
test_14.txt AC 1 ms 3716 KiB
test_15.txt AC 1 ms 3768 KiB
test_16.txt AC 1 ms 3740 KiB
test_17.txt AC 1 ms 3760 KiB
test_18.txt AC 1 ms 3700 KiB
test_19.txt AC 1 ms 3876 KiB
test_20.txt AC 1 ms 3748 KiB
test_21.txt AC 1 ms 3876 KiB
test_22.txt AC 1 ms 3880 KiB
test_23.txt AC 1 ms 3876 KiB