Submission #73893912


Source Code Expand

#include<bits/stdc++.h>
// #include<atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, n) for(int  i = 0; i < (n); ++i)
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;
int gcd(int a, int b){
    if(b == 0) return a;  
    else return gcd(b, a%b);
}
struct Compare {
    bool operator()(const pair<ll, int>& a, const pair<ll, int>& b) {
        return a.first > b.first;  
    }
};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,q; cin >> n >> q;
    vector<pair<int,int>> a(n);
    rep(i,n){
        cin >> a[i].first;
        a[i].second = i+1;
    }
    sort(a.begin(), a.end());
    while(q--){
        int k; cin >> k;
        vector<int> b(k);
        rep(i,k) cin >> b[i];
        int idx = 0;
        while(1){
            if(idx == k) break;
            bool check = false;
            rep(i,k){
                if(a[idx].second == b[i])check = true;
            }
            if(!check) break;
            idx++;
        }
        cout << a[idx].first << endl;
    }
}

Submission Info

Submission Time
Task C - Except and Min
User motomoto0001
Language C++23 (GCC 15.2.0)
Score 300
Code Size 1271 Byte
Status AC
Exec Time 101 ms
Memory 5816 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 19
Set Name Test Cases
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
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3488 KiB
01_random_00.txt AC 98 ms 5784 KiB
01_random_01.txt AC 94 ms 5704 KiB
01_random_02.txt AC 98 ms 5816 KiB
01_random_03.txt AC 99 ms 5704 KiB
01_random_04.txt AC 97 ms 5704 KiB
01_random_05.txt AC 98 ms 5684 KiB
02_random_2_00.txt AC 97 ms 5700 KiB
02_random_2_01.txt AC 96 ms 5700 KiB
02_random_2_02.txt AC 98 ms 5728 KiB
02_random_2_03.txt AC 101 ms 5796 KiB
02_random_2_04.txt AC 96 ms 5816 KiB
02_random_2_05.txt AC 96 ms 5588 KiB
03_random_3_00.txt AC 98 ms 5648 KiB
03_random_3_01.txt AC 98 ms 5796 KiB
03_random_3_02.txt AC 99 ms 5700 KiB
03_random_3_03.txt AC 99 ms 5784 KiB
03_random_3_04.txt AC 100 ms 5728 KiB
03_random_3_05.txt AC 98 ms 5796 KiB