# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
521007 |
2022-01-31T15:35:29 Z |
lucri |
DEL13 (info1cup18_del13) |
C++17 |
|
10 ms |
460 KB |
#include <iostream>
using namespace std;
int t,n,f[210],b[210],a[210],q,ans[210];
bool ok[210];
int main()
{
cin>>t;
while(t--)
{
ans[0]=0;
cin>>n>>q;
for(int i=1;i<=q;++i)
cin>>f[i];
int j=1;
for(int i=1;i<=n;++i)
{
if(f[j]==i)
{
++j;
ok[i]=true;
}
else
ok[i]=false;
b[i]=i-1;
a[i]=i+1;
}
a[0]=1;
f[q+1]=n+1;
++q;
for(int i=2;i<=q;++i)
{
if(f[i]-f[i-1]>3)
{
int z=(f[i]+f[i-1])/2;
while(ok[b[z]]==false&&ok[a[z]]==false&&b[z]!=f[i-1])
{
ans[++ans[0]]=z;
a[b[b[z]]]=z;
b[a[a[z]]]=z;
int q=a[a[z]];
a[a[z]]=n+1;
a[z]=q;
q=b[b[z]];
b[b[z]]=0;
b[z]=q;
}
}
}
--q;
for(int i=1;i<=n;++i)
{
while(ok[b[i]]==false&&ok[a[i]]==false&&b[i]!=0&&a[i]!=n+1)
{
ans[++ans[0]]=i;
a[b[b[i]]]=i;
b[a[a[i]]]=i;
int q=a[a[i]];
a[a[i]]=n+1;
a[i]=q;
q=b[b[i]];
b[b[i]]=0;
b[i]=q;
}
}
for(int i=a[0];i<=n;i=a[i])
{
if(ok[i]==false)
{
ans[0]=-1;
break;
}
}
cout<<ans[0]<<'\n';
for(int i=1;i<=ans[0];++i)
cout<<ans[i]<<' ';
if(ans[0]>0)
cout<<'\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
308 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 11 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
308 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
300 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
308 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
8 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 11 |
9 |
Runtime error |
1 ms |
424 KB |
Execution killed with signal 11 |
10 |
Runtime error |
1 ms |
440 KB |
Execution killed with signal 11 |
11 |
Runtime error |
2 ms |
460 KB |
Execution killed with signal 11 |