QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#73781#3017. Missing GnomesIndexRE 1ms1752kbC11560b2023-01-28 12:13:362023-01-28 12:13:39

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-28 12:13:39]
  • 评测
  • 测评结果:RE
  • 用时:1ms
  • 内存:1752kb
  • [2023-01-28 12:13:36]
  • 提交

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

output:


result: