Submission #73903640


Source Code Expand

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

int main(){
  ll N,Q,K,ans;
  cin >> N >> Q;
  vector<pair<ll,ll>> A(N);
  vector<ll> C(N),D(N);
  for(ll i = 0;i < N;i++){
    cin >> A[i].first;
    A[i].second = i;
  }
  sort(A.begin(),A.end());
  for(ll i = 0;i < N;i++){
    C[A[i].second] = i;
  }
  for(ll i = 0;i < Q;i++){
    cin >> K;
    vector<ll> B(K);
    for(ll j = 0;j < K;j++){
      cin >> B[j];
      D[C[B[j] - 1]] = 1;
    }
    for(ll j = 0;j < K + 1;j++){
      if(D[j] == 0){
        cout << A[j].first << endl;
        break;
      }
    }
    for(ll j = 0;j < K;j++){
      D[C[B[j] - 1]] = 0;
    }
  }
}

Submission Info

Submission Time
Task C - Except and Min
User MI6174
Language C++23 (GCC 15.2.0)
Score 300
Code Size 684 Byte
Status AC
Exec Time 234 ms
Memory 12844 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:6:12: warning: unused variable 'ans' [-Wunused-variable]
    6 |   ll N,Q,K,ans;
      |            ^~~

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 3560 KiB
01_random_00.txt AC 233 ms 12652 KiB
01_random_01.txt AC 186 ms 12776 KiB
01_random_02.txt AC 223 ms 12844 KiB
01_random_03.txt AC 232 ms 12656 KiB
01_random_04.txt AC 208 ms 12648 KiB
01_random_05.txt AC 207 ms 12776 KiB
02_random_2_00.txt AC 233 ms 12524 KiB
02_random_2_01.txt AC 220 ms 12788 KiB
02_random_2_02.txt AC 198 ms 12588 KiB
02_random_2_03.txt AC 229 ms 12560 KiB
02_random_2_04.txt AC 195 ms 12652 KiB
02_random_2_05.txt AC 193 ms 12752 KiB
03_random_3_00.txt AC 226 ms 12716 KiB
03_random_3_01.txt AC 229 ms 12664 KiB
03_random_3_02.txt AC 234 ms 12776 KiB
03_random_3_03.txt AC 224 ms 12648 KiB
03_random_3_04.txt AC 231 ms 12660 KiB
03_random_3_05.txt AC 228 ms 12776 KiB