提出 #55052183


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using pl = pair<ll, ll>;
constexpr ll INF = 1e9 + 7;
constexpr ll mod = 1e9 + 7;
constexpr ld eps = 1e-9;
const ld PI = acos(-1);

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (auto &i: a)cin >> i, --i;
    vector<ll> w(n);
    for (auto &i: w)cin >> i;
    vector<vector<ll>> all(n);
    for(ll i = 0;i <n;++i){
        all[a[i]].push_back(w[i]);
    }
    int res{0};
    for(int i = 0;i < n;++i){
        sort(all[i].begin(),all[i].end());
        for(int j = 0;j + 1 < all[i].size();++j)res += all[i][j];
    }
    cout << res;
    return 0;
}

提出情報

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

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:28:29: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   28 |         for(int j = 0;j + 1 < all[i].size();++j)res += all[i][j];
      |                       ~~~~~~^~~~~~~~~~~~~~~

ジャッジ結果

セット名 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 3464 KiB
00_sample_01.txt AC 1 ms 3392 KiB
01_random_00.txt AC 16 ms 9208 KiB
01_random_01.txt AC 8 ms 5972 KiB
01_random_02.txt AC 16 ms 9064 KiB
01_random_03.txt AC 13 ms 7996 KiB
01_random_04.txt AC 16 ms 9064 KiB
01_random_05.txt AC 7 ms 5880 KiB
01_random_06.txt AC 16 ms 9104 KiB
01_random_07.txt AC 14 ms 8320 KiB
01_random_08.txt AC 16 ms 9048 KiB
01_random_09.txt AC 15 ms 8852 KiB
01_random_10.txt AC 16 ms 9116 KiB
01_random_11.txt AC 6 ms 5016 KiB
01_random_12.txt AC 16 ms 9036 KiB
01_random_13.txt AC 13 ms 7988 KiB
01_random_14.txt AC 16 ms 9112 KiB
01_random_15.txt AC 12 ms 7800 KiB
02_corner_00.txt AC 7 ms 6484 KiB
02_corner_01.txt AC 15 ms 10176 KiB
02_corner_02.txt AC 16 ms 7972 KiB
02_corner_03.txt AC 14 ms 7720 KiB
02_corner_04.txt AC 14 ms 8040 KiB