Submission #68133106


Source Code Expand

#include<bits/stdc++.h>
#define ll long long
#define ld long double

using namespace std;

int main(){

  int n, m, x; scanf("%d%d", &n, &m);
  x = n;
  int a[n], b[m];
  map<int,int> mp;
  for(int i = 0; i < n ; i++){
    scanf("%d", &a[i]);
    mp[a[i]]++;
  }
  for(int i = 0; i < m ; i++){
    scanf("%d", &b[i]);
  }
  for(int i = 0; i < m ; i++){
    if(mp[b[i]] > 0 && x){
      mp[b[i]]--;
      x--;
    }
  }
  if(x <= 0){
    printf(" ");
  }
  else{
    for(auto [a,b] : mp){
      for(int i = 0; i < b; i++){
        printf("%d ", a);
      }
    }
  }
  
 return 0;
}

Submission Info

Submission Time
Task B - Search and Delete
User JyuK_SIR
Language C++ 20 (gcc 12.2)
Score 200
Code Size 618 Byte
Status AC
Exec Time 1 ms
Memory 3880 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:9:21: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |   int n, m, x; scanf("%d%d", &n, &m);
      |                ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |     scanf("%d", &a[i]);
      |     ~~~~~^~~~~~~~~~~~~
Main.cpp:18:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   18 |     scanf("%d", &b[i]);
      |     ~~~~~^~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 28
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3572 KiB
example_01.txt AC 1 ms 3692 KiB
hand_00.txt AC 1 ms 3576 KiB
hand_01.txt AC 1 ms 3752 KiB
hand_02.txt AC 1 ms 3684 KiB
hand_03.txt AC 1 ms 3680 KiB
hand_04.txt AC 1 ms 3672 KiB
hand_05.txt AC 1 ms 3808 KiB
random_00.txt AC 1 ms 3660 KiB
random_01.txt AC 1 ms 3816 KiB
random_02.txt AC 1 ms 3756 KiB
random_03.txt AC 1 ms 3760 KiB
random_04.txt AC 1 ms 3756 KiB
random_05.txt AC 1 ms 3880 KiB
random_06.txt AC 1 ms 3816 KiB
random_07.txt AC 1 ms 3692 KiB
random_08.txt AC 1 ms 3748 KiB
random_09.txt AC 1 ms 3688 KiB
random_10.txt AC 1 ms 3664 KiB
random_11.txt AC 1 ms 3752 KiB
random_12.txt AC 1 ms 3656 KiB
random_13.txt AC 1 ms 3616 KiB
random_14.txt AC 1 ms 3600 KiB
random_15.txt AC 1 ms 3676 KiB
random_16.txt AC 1 ms 3576 KiB
random_17.txt AC 1 ms 3616 KiB
random_18.txt AC 1 ms 3748 KiB
random_19.txt AC 1 ms 3568 KiB