提出 #55116150


ソースコード 拡げる

// {{{
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
#define debug(x...)
#define debug_arr(x...)
#ifdef LOCAL
#include "prettyprint.hpp"
#endif
// }}}

const int N = 1e5 + 10;
int n;
int a[N], w[N];
map<int, vi> mp;

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    while (cin >> n)
    {
        mp.clear();
        for (int i = 1; i <= n; ++i) cin >> a[i];
        for (int i = 1; i <= n; ++i) cin >> w[i];
        for (int i = 1; i <= n; ++i)
        {
            mp[a[i]].push_back(w[i]);
        }

        int ans = 0;
        for (auto& pr : mp)
        {
            sort(all(pr.second));
            int l = pr.second.size();
            for (int i = 0; i + 1 < l; i++) ans += pr.second[i];
        }
        cout << ans << endl;
    }

    return 0;
}

提出情報

提出日時
問題 C - Move It
ユーザ mickeyandkaka
言語 C++ 20 (gcc 12.2)
得点 250
コード長 1053 Byte
結果 AC
実行時間 70 ms
メモリ 15208 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 250 / 250
結果
AC × 2
AC × 23
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 02_corner_04.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3576 KiB
00_sample_01.txt AC 1 ms 3480 KiB
01_random_00.txt AC 61 ms 11240 KiB
01_random_01.txt AC 27 ms 7180 KiB
01_random_02.txt AC 60 ms 11328 KiB
01_random_03.txt AC 48 ms 9932 KiB
01_random_04.txt AC 61 ms 11136 KiB
01_random_05.txt AC 27 ms 7096 KiB
01_random_06.txt AC 62 ms 11216 KiB
01_random_07.txt AC 51 ms 10112 KiB
01_random_08.txt AC 61 ms 11272 KiB
01_random_09.txt AC 61 ms 10916 KiB
01_random_10.txt AC 62 ms 11360 KiB
01_random_11.txt AC 22 ms 6548 KiB
01_random_12.txt AC 60 ms 11188 KiB
01_random_13.txt AC 48 ms 9928 KiB
01_random_14.txt AC 61 ms 11172 KiB
01_random_15.txt AC 46 ms 9416 KiB
02_corner_00.txt AC 32 ms 9360 KiB
02_corner_01.txt AC 70 ms 15208 KiB
02_corner_02.txt AC 35 ms 4484 KiB
02_corner_03.txt AC 33 ms 4540 KiB
02_corner_04.txt AC 29 ms 4596 KiB