QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73781 | #3017. Missing Gnomes | Index | RE | 1ms | 1752kb | C11 | 560b | 2023-01-28 12:13:36 | 2023-01-28 12:13:39 |
Judging History
answer
#include <stdio.h>
int a[103000], chk[103000], res[103000];
int main(void) {
int n, m, rcnt = 0, p = 0;
scanf("%d %d", &n, &m);
for (int i = 0; i < m; i++) {
scanf("%d", &a[i]);
chk[a[i]] = 1;
}
for (int i = 1; i <= n; i++) {
if (chk[i]) continue;
while (p < m && i > a[p]) {
res[rcnt++] = a[p];
p++;
}
res[rcnt++] = i;
}
if (rcnt != n) return 1;
for (int i = 0; i < n; i++) {
printf("%d\n", res[i]);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 1560kb
input:
5 3 1 4 2
output:
1 3 4 2 5
result:
ok 5 number(s): "1 3 4 2 5"
Test #2:
score: 0
Accepted
time: 1ms
memory: 1752kb
input:
7 4 6 4 2 1
output:
3 5 6 4 2 1 7
result:
ok 7 numbers
Test #3:
score: -100
Runtime Error
input:
1 1 1