QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#679300 | #3017. Missing Gnomes | Imran_86 | WA | 0ms | 3684kb | C++20 | 1.4kb | 2024-10-26 17:19:01 | 2024-10-26 17:19:03 |
Judging History
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'