Untitled
raw download clone
C
views 31
,
size 569 b
#include<stdio.h>

int e[100001];
int A[200001],CA[200001],e_inv[200001];//CA check if e pick



int main(void)
{
     int n,m,temp;
     scanf("%d %d\n",&n,&m);
     for(int i=1;i<=n;i++)
     {
          A[i]=i;
     }
     for(int i=1;i<=m;i++)
     {
          scanf("%d",&e[i]);
          CA[e[i]]=1;
          e_inv[e[i]]=i;
     }

     for(int i=m;i>0;i--)
     {
          if(i==e_inv[e[i]])printf("%d\n",e[i]);
     }

     for(int i=1;i<=n;i++)
     {
          if(CA[i]==0)printf("%d\n",A[i]);
     }



     return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.