提出 #73912112


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

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

    int N, Q;
    cin >> N >> Q;
    vector<long long> A(N+1);
    multiset<long long> S;

    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        S.insert(A[i]);
    }

    while (Q--) {
        int K;
        cin >> K;
        vector<int> B(K);
        for (int i = 0; i < K; i++) cin >> B[i];

        // 移除球
        for (int i = 0; i < K; i++) {
            S.erase(S.find(A[B[i]]));
        }

        // 输出当前最小值
        cout << *S.begin() << "\n";

        // 放回球
        for (int i = 0; i < K; i++) {
            S.insert(A[B[i]]);
        }
    }

    return 0;
}

提出情報

提出日時
問題 C - Except and Min
ユーザ wmxw
言語 C++23 (GCC 15.2.0)
得点 300
コード長 759 Byte
結果 AC
実行時間 442 ms
メモリ 19916 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 1
AC × 19
セット名 テストケース
Sample 00_sample_00.txt
All 00_sample_00.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, 02_random_2_00.txt, 02_random_2_01.txt, 02_random_2_02.txt, 02_random_2_03.txt, 02_random_2_04.txt, 02_random_2_05.txt, 03_random_3_00.txt, 03_random_3_01.txt, 03_random_3_02.txt, 03_random_3_03.txt, 03_random_3_04.txt, 03_random_3_05.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3540 KiB
01_random_00.txt AC 328 ms 19856 KiB
01_random_01.txt AC 164 ms 19776 KiB
01_random_02.txt AC 326 ms 19844 KiB
01_random_03.txt AC 325 ms 19840 KiB
01_random_04.txt AC 389 ms 19772 KiB
01_random_05.txt AC 442 ms 19724 KiB
02_random_2_00.txt AC 265 ms 19864 KiB
02_random_2_01.txt AC 266 ms 19788 KiB
02_random_2_02.txt AC 314 ms 19656 KiB
02_random_2_03.txt AC 266 ms 19916 KiB
02_random_2_04.txt AC 264 ms 19800 KiB
02_random_2_05.txt AC 265 ms 19720 KiB
03_random_3_00.txt AC 207 ms 19852 KiB
03_random_3_01.txt AC 207 ms 19844 KiB
03_random_3_02.txt AC 207 ms 19856 KiB
03_random_3_03.txt AC 206 ms 19856 KiB
03_random_3_04.txt AC 206 ms 19904 KiB
03_random_3_05.txt AC 205 ms 19788 KiB