結果

問題 No.1390 Get together
ユーザー Mitarushi
提出日時 2021-02-12 22:10:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 926 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 200,940 KB
最終ジャッジ日時 2025-01-18 18:42:00
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

template<class T>
void print(const T &t) { std::cout << t << '\n'; }

template<class Head, class... Tail>
void print(const Head &head, const Tail &... tail) {
    std::cout << head << ' ';
    print(tail...);
}

template<typename T>
using v = std::vector<T>;
using ll = long long;
using std::cin;

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    int n, m;
    cin >> n >> m;

    v<std::map<int, int>> s(n);
    v<int> col(n);

    for (int i = 0; i < n; ++i) {
        int b, c;
        cin >> b >> c;
        c--;
        s[c][b]++;
        col[c] += 1;
    }

    int ans = 0;
    for (int i = 0; i < n; ++i) {
        if (!col[i]) {
            continue;
        }

        int max = 0;
        for (auto &[key, value]: s[i]) {
            max = std::max(max, value);
        }

        ans += col[i] - max;
    }
    print(ans);

}
0