UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#209831#3721. 没活ftb100102ms2040kbC++111.1kb2024-08-05 09:44:212024-08-05 12:35:06

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
void read() {}
template<typename T, typename... T2>
inline void read(T &x, T2 &... oth) {
    x = 0;
    int ch = getchar(), f = 0;
    while(ch < '0' || ch > '9') {
        if(ch == '-') f = 1;
        ch = getchar();
    }
    while(ch >= '0' && ch <= '9') {
        x = (x << 1) + (x << 3) + (ch ^ 48);
        ch = getchar();
    }
    if(f)x = -x;
    read(oth...);
}
inline void write(int a) {
    if(a < 0) putchar('-'), a = -a;
    if(a >= 10)write(a / 10);
    putchar(a % 10 + 48);
}
void qui(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);cout.tie(nullptr);
}
const int maxn=1e5+500;
bool flag[maxn];
int n,m,a[maxn],b[maxn],tot;
signed main(){
	read(n,m);
	for(int i=1;i<=m;i++)
		read(a[i]),flag[a[i]]=true;
	for(int i=1;i<=n;i++)
	if(!flag[i])b[++tot]=i;
	int k1=1,k2=1;
	while(k1<=m||k2<=tot){
		if(k2>tot){
			printf("%lld ",a[k1++]);
			continue;
		}
		if(k1>m){
			printf("%lld ",b[k2++]);
			continue;
		}
		if(a[k1]<b[k2]) printf("%lld ",a[k1++]);
		else printf("%lld ",b[k2++]);
	}
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 30
Accepted

Test #1:

score: 30
Accepted
time: 0ms
memory: 1160kb

input:

10 10
10 8 6 7 3 5 4 2 1 9

output:

10 8 6 7 3 5 4 2 1 9 

result:

ok 10 numbers

Test #2:

score: 0
Accepted
time: 1ms
memory: 1156kb

input:

10 7
6 4 5 9 3 7 1

output:

2 6 4 5 8 9 3 7 1 10 

result:

ok 10 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 1156kb

input:

10 6
4 6 10 7 8 9

output:

1 2 3 4 5 6 10 7 8 9 

result:

ok 10 numbers

Test #4:

score: 0
Accepted
time: 0ms
memory: 1160kb

input:

10 2
8 1

output:

2 3 4 5 6 7 8 1 9 10 

result:

ok 10 numbers

Test #5:

score: 0
Accepted
time: 0ms
memory: 1156kb

input:

10 1
2

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 0ms
memory: 1156kb

input:

10 10
7 1 10 4 8 2 9 5 3 6

output:

7 1 10 4 8 2 9 5 3 6 

result:

ok 10 numbers

Test #7:

score: 0
Accepted
time: 0ms
memory: 1160kb

input:

10 1
8

output:

1 2 3 4 5 6 7 8 9 10 

result:

ok 10 numbers

Test #8:

score: 0
Accepted
time: 0ms
memory: 1156kb

input:

10 7
2 8 10 4 9 7 6

output:

1 2 3 5 8 10 4 9 7 6 

result:

ok 10 numbers

Test #9:

score: 0
Accepted
time: 0ms
memory: 1156kb

input:

10 9
2 10 7 1 4 5 6 9 3

output:

2 8 10 7 1 4 5 6 9 3 

result:

ok 10 numbers

Test #10:

score: 0
Accepted
time: 0ms
memory: 1156kb

input:

10 5
6 2 10 1 7

output:

3 4 5 6 2 8 9 10 1 7 

result:

ok 10 numbers

Subtask #2:

score: 60
Accepted

Test #11:

score: 60
Accepted
time: 12ms
memory: 2036kb

input:

100000 83429
90375 90108 26962 38821 69379 71801 56633 12101 43739 26223 79383 14701 17147 88534 509...

output:

5 10 11 14 20 21 24 44 51 54 68 73 74 77 82 84 88 89 102 105 125 128 133 145 155 158 161 168 171 174...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 12ms
memory: 2040kb

input:

100000 82962
73394 73117 14725 35820 97545 6010 50822 71510 25492 23884 38666 91955 66401 39510 7917...

output:

5 6 13 20 21 30 31 33 41 42 45 48 60 61 67 68 71 74 78 79 85 88 91 100 103 110 118 120 125 146 148 1...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 9ms
memory: 2040kb

input:

100000 19603
83897 74775 26521 36156 59377 36083 49892 51610 93203 99294 98846 17464 28929 32908 880...

output:

1 2 3 5 6 7 8 10 13 14 15 16 17 18 19 20 21 23 24 26 27 28 30 31 32 34 35 36 37 38 39 40 41 43 44 45...

result:

ok 100000 numbers

Test #14:

score: 0
Accepted
time: 8ms
memory: 2040kb

input:

100000 62547
96864 83362 99504 45281 74011 67108 99894 85274 20131 92638 17470 16103 21527 69097 646...

output:

3 5 9 11 13 14 15 16 17 18 19 20 21 25 26 27 38 41 44 45 46 47 50 52 53 54 55 58 59 69 70 73 74 75 7...

result:

ok 100000 numbers

Test #15:

score: 0
Accepted
time: 9ms
memory: 2036kb

input:

100000 76769
76819 2446 28187 64723 58935 75127 31585 49177 11052 3423 58916 10036 61413 48617 89959...

output:

4 6 10 13 16 17 22 23 26 31 36 38 42 50 57 59 68 71 81 84 85 95 98 110 114 123 128 133 141 146 148 1...

result:

ok 100000 numbers

Test #16:

score: 0
Accepted
time: 12ms
memory: 2040kb

input:

100000 35192
49829 16138 96223 81943 76904 91220 52416 76061 27820 29214 51150 77561 21261 91103 118...

output:

1 2 3 8 10 12 13 15 17 18 19 20 22 23 28 31 33 34 36 37 38 40 43 45 46 47 48 49 50 52 53 56 59 60 61...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 8ms
memory: 2036kb

input:

100000 77693
84873 41812 27789 62974 73642 9324 1843 77708 52834 14757 98531 59108 8858 11253 62216 ...

output:

4 5 10 12 15 29 33 51 54 56 57 68 74 77 78 86 91 95 96 104 106 110 128 132 140 142 143 148 149 151 1...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 10ms
memory: 2040kb

input:

100000 16998
19538 66167 75648 35452 89050 79666 2516 90220 34532 96829 44255 92489 58346 85308 1576...

output:

2 6 7 9 11 13 14 15 16 18 19 21 22 23 24 27 28 29 30 31 32 33 34 35 36 37 39 41 43 44 45 46 48 50 51...

result:

ok 100000 numbers

Test #19:

score: 0
Accepted
time: 9ms
memory: 2036kb

input:

100000 47758
76928 16362 24161 1087 48584 18491 79473 87121 27330 22145 93414 19065 58241 89834 1269...

output:

1 4 6 8 10 11 14 15 17 18 19 20 22 23 25 26 27 28 30 31 33 37 38 42 44 46 50 51 52 54 58 60 64 65 66...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 11ms
memory: 2040kb

input:

100000 24966
34313 20125 99049 84865 52680 24134 78711 83970 9564 29726 92093 57895 12683 73524 6918...

output:

1 2 3 4 6 7 8 9 10 11 13 14 15 16 17 18 19 20 22 23 24 25 26 27 28 30 31 32 34 35 36 38 39 40 41 42 ...

result:

ok 100000 numbers

Extra Test:

score: 0
Extra Test Passed