提出 #73892841


ソースコード 拡げる

#include <bits/stdc++.h>

using namespace std;

int main() {
    int n, q; cin >> n >> q;
    vector<pair<int, int>> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i].first;
        a[i].second = i+1;
    }
    sort(a.begin(), a.end());
    
    vector<int> newID(1+n);
    for (int i = 0; i < n; ++i) {
        newID[a[i].second] = i;
    }

    while (q--) {
        int k; cin >> k;
        vector<int> b(k);
        for (int &x : b) {
            cin >> x;
            x = newID[x];
        }
        sort(b.begin(), b.end());
        int firstMissing = k;
        for (int i = 0; i < k; ++i) {
            if (b[i] != i) {
                firstMissing = i;
                break;
            }
        }

        cout << a[firstMissing].first << '\n';
    }
    return 0;
}

提出情報

提出日時
問題 C - Except and Min
ユーザ erekle
言語 C++ IOI-Style(GNU++20) (GCC 14.2.0)
得点 300
コード長 827 Byte
結果 AC
実行時間 243 ms
メモリ 5164 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 0 ms 1580 KiB
01_random_00.txt AC 239 ms 5164 KiB
01_random_01.txt AC 197 ms 5164 KiB
01_random_02.txt AC 230 ms 5164 KiB
01_random_03.txt AC 240 ms 5164 KiB
01_random_04.txt AC 220 ms 5164 KiB
01_random_05.txt AC 217 ms 5164 KiB
02_random_2_00.txt AC 241 ms 5164 KiB
02_random_2_01.txt AC 227 ms 5164 KiB
02_random_2_02.txt AC 209 ms 5164 KiB
02_random_2_03.txt AC 238 ms 5164 KiB
02_random_2_04.txt AC 205 ms 5164 KiB
02_random_2_05.txt AC 201 ms 5164 KiB
03_random_3_00.txt AC 237 ms 5164 KiB
03_random_3_01.txt AC 238 ms 5164 KiB
03_random_3_02.txt AC 243 ms 5164 KiB
03_random_3_03.txt AC 229 ms 5164 KiB
03_random_3_04.txt AC 243 ms 5164 KiB
03_random_3_05.txt AC 238 ms 5164 KiB