QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#679300#3017. Missing GnomesImran_86WA 0ms3684kbC++201.4kb2024-10-26 17:19:012024-10-26 17:19:03

Judging History

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

  • [2024-10-26 17:19:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-10-26 17:19:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int h[1000000+10];
int main()
{

        int n,m;
        cin>>n>>m;
        int a[m+1];
        for(int i=0; i<m; i++)
        {
            cin>>a[i];
            h[a[i]]=1;

        }
        int k=0;
        int c[n-m+1];
        for(int i=1; i<=n; i++)
        {
            if(h[i]!=1)
            {
                c[k]=i;
                k++;
            }
        }

        sort(c,c+k);
        int l=0;
        int l1=0;
        int c1=0,c2=0;
        while(1)
        {
            if(c[l]<a[l1])
            {
                cout<<c[l]<<'\n';
                l++;
                if(l==k)
                {

                    c1=1;
                    break;
                }

            }
            else
            {
                cout<<a[l1]<<'\n';
                l1++;
                if(l1==m)
                {

                    c2=1;
                    break;
                }

            }

        }
        if(c1==1)
        {
            for(int p=l1; p<m-1; p++)
            {
                cout<<a[p]<<'\n';
            }
            cout<<a[m-1];


        }
        if(c2==1)
        {
            for(int p=l; p<k-1; p++)
            {
                cout<<c[p]<<'\n';
            }
            cout<<c[k-1];


        }



}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3668kb

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: 0ms
memory: 3632kb

input:

7 4
6
4
2
1

output:

3
5
6
4
2
1
7

result:

ok 7 numbers

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3684kb

input:

1 1
1

output:

-1102613904
1
21846

result:

wrong answer 1st numbers differ - expected: '1', found: '-1102613904'