提出 #75239592


ソースコード 拡げる

#line 2 "/Users/blue_jam/ProconLibrary/misc/template.hpp"

#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

#define ALL(x) (x).begin(), (x).end()

using ll = long long;
#ifndef EPS
const double eps = 1e-10;
#else
const double eps = EPS;
#endif
#line 2 "abc455/C/main.cpp"


void solve(long long N, long long K, std::vector<long long> A) {
    map<ll, ll> mp;
    for (auto t: A) {
        mp[t] += t;
    }
    vector<pair<ll, ll>> v;
    for (auto [a, b] : mp) {
        v.push_back({b, a});
    }
    sort(ALL(v));
    ll ans = 0;
    for (ll i = 0; i < (ll)v.size() - K; i++) {
        ans += v[i].first;
    }
    cout << ans << endl;
}

int main() {
    long long N;
    std::scanf("%lld", &N);
    long long K;
    std::scanf("%lld", &K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        std::scanf("%lld", &A[i]);
    }
    solve(N, K, std::move(A));
    return 0;
}

提出情報

提出日時
問題 C - Vanish
ユーザ blue_jam
言語 C++23 (GCC 15.2.0)
得点 300
コード長 995 Byte
結果 AC
実行時間 183 ms
メモリ 32956 KiB

コンパイルエラー

abc455/C/main.cpp: In function 'void solve(long long int, long long int, std::vector<long long int>)':
abc455/C/main.cpp:4:22: warning: unused parameter 'N' [-Wunused-parameter]

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 31
セット名 テストケース
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 1 ms 3824 KiB
sample01.txt AC 1 ms 3744 KiB
sample02.txt AC 1 ms 3724 KiB
testcase00.txt AC 1 ms 3700 KiB
testcase01.txt AC 1 ms 3624 KiB
testcase02.txt AC 148 ms 26136 KiB
testcase03.txt AC 182 ms 32948 KiB
testcase04.txt AC 115 ms 22548 KiB
testcase05.txt AC 179 ms 32796 KiB
testcase06.txt AC 57 ms 14896 KiB
testcase07.txt AC 183 ms 32956 KiB
testcase08.txt AC 5 ms 4120 KiB
testcase09.txt AC 20 ms 5860 KiB
testcase10.txt AC 6 ms 4004 KiB
testcase11.txt AC 24 ms 5852 KiB
testcase12.txt AC 12 ms 4724 KiB
testcase13.txt AC 28 ms 6004 KiB
testcase14.txt AC 33 ms 5876 KiB
testcase15.txt AC 33 ms 5860 KiB
testcase16.txt AC 86 ms 13000 KiB
testcase17.txt AC 103 ms 14392 KiB
testcase18.txt AC 6 ms 3844 KiB
testcase19.txt AC 31 ms 5820 KiB
testcase20.txt AC 75 ms 10328 KiB
testcase21.txt AC 107 ms 14732 KiB
testcase22.txt AC 20 ms 5900 KiB
testcase23.txt AC 162 ms 32884 KiB
testcase24.txt AC 105 ms 14740 KiB
testcase25.txt AC 19 ms 5872 KiB
testcase26.txt AC 30 ms 6188 KiB
testcase27.txt AC 30 ms 6052 KiB