11617 - pA - Arranging a Sequence
raw download clone
C
views 23
,
size 504 b
#include <stdio.h>

int main(void)
{
    int n, m;
    int e[100001], s[200001] = {0}, v[200001] = {0};

    scanf("%d%d", &n, &m);
    for(int i=1; i<=m; i++)
    {
        scanf("%d", &e[i]);
        s[e[i]] = 1;
    }
    for(int j=m; j>=1; j--)
    {
        if(v[e[j]] == 0)
        {
            printf("%d\n", e[j]);
            v[e[j]] = 1;
        }
    }
    for(int k=1; k<=n; k++)
    {
        if(s[k] != 1)
            printf("%d\n", k);
    }

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