-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCleaningUp.cpp
41 lines (40 loc) · 931 Bytes
/
CleaningUp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<stdio.h>
inline int fast_scan()
{
int n=0;
int ch=getchar_unlocked();
while( ch <48 )ch=getchar_unlocked();
while( ch >47 )
n = (n<<3)+(n<<1) + ch-'0', ch=getchar_unlocked();
return n;
}
int main()
{
unsigned short T = fast_scan();
while(T--)
{
char hash[1010]={0};
unsigned short M,N;
unsigned short i = 0;
N = fast_scan();
M = fast_scan();
while(M--)
{
unsigned short num = fast_scan();
hash[num] = '0';
}
while(i<=N)
{
while(hash[++i]== '0' && i<=N);
hash[i] = '1';
while(hash[++i] == '0' && i<=N);
hash[i] = '2';
}
putchar('\n');
for(i=1;i<=N;i++) if(hash[i]=='1') printf("%d ",i);
putchar('\n');
for(i=1;i<=N;i++) if(hash[i]=='2') printf("%d ",i);
// putchar('\n');
}
return 0;
}