# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
521064 |
2022-01-31T17:02:23 Z |
lucri |
DEL13 (info1cup18_del13) |
C++17 |
|
13 ms |
336 KB |
#include <iostream>
#include <fstream>
using namespace std;
int t,n,f[210],q,ans[210];
struct blocuri{int poz,nrs,fmax;}a[210];
ofstream out("fisier.txt");
int main()
{
cin>>t;
while(t--)
{
ans[0]=0;
cin>>n>>q;
for(int i=2;i<=q+1;++i)
cin>>f[i];
f[q+2]=n+1;
a[q+1].fmax=0;
f[1]=0;
++q;
for(int i=1;i<=q;++i)
{
a[i].poz=(f[i]+f[i+1])/2;
if(f[i+1]-f[i]<=3)
{
a[i].nrs=0;
a[i].fmax=f[i+1]-f[i]-1;
}
else
{
a[i].nrs=(f[i+1]-f[i]-4)/2;
if((f[i+1]-f[i])%2==0)
a[i].fmax=3;
else
a[i].fmax=4;
}
for(int j=1;j<=a[i].nrs;++j)
ans[++ans[0]]=a[i].poz;
}
for(int i=1;i<=q;++i)
{
if(a[i-1].fmax==0&&a[i].fmax!=0&&a[i+1].fmax==0)
ans[0]=-1;
else if(a[i-1].fmax==0&&a[i].fmax!=0)
{
if(a[i].fmax>2)
{
a[i].fmax-=2;
ans[++ans[0]]=a[i].poz;
}
}
else if(a[i].fmax!=0)
{
a[i].fmax-=a[i-1].fmax;
if(a[i].fmax<0)
ans[0]=-1;
else if(a[i+1].fmax==0)
{
if(a[i].fmax==2&&a[i-1].fmax!=0)
{
a[i].fmax-=2;
ans[++ans[0]]=a[i].poz;
}
else if(a[i].fmax!=0)
ans[0]=-1;
}
if(ans[0]>=0&&a[i].fmax>2)
{
ans[++ans[0]]=a[i].poz;
a[i].fmax-=2;
}
if(a[i+1].fmax==1)
{
if(a[i].fmax==2)
{
if(a[i-1].fmax!=0)
{
a[i].fmax-=2;
ans[++ans[0]]=a[i].poz;
}
else
ans[0]=-1;
}
}
if(ans[0]>=0)
for(int j=0;j<a[i-1].fmax;++j)
ans[++ans[0]]=f[i];
}
if(ans[0]<0)
break;
}
cout<<ans[0]<<'\n';
out<<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 |
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 |
204 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
13 ms |
336 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
2 |
Runtime error |
2 ms |
332 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 |
204 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
13 ms |
336 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 |
1 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 |
204 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
332 KB |
Output isn't correct |
4 |
Incorrect |
13 ms |
336 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 |
1 ms |
204 KB |
Output isn't correct |
8 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
9 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
10 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |
11 |
Runtime error |
1 ms |
332 KB |
Execution killed with signal 11 |