#include <iostream>
#include <algorithm>
using namespace std;
struct vc{
int a,ind;
}v[10000];
bool cmp(vc a,vc b){
if(a.a<b.a)
return 1;
else
return 0;
}
int n,m;
bool verf(int mij){
int z,i=1;
z=mij-1;i=1;
while(z<m-1 && i<=n){
if(i>v[z].a)
break;
i++;
z=min(z+mij,m-1);
}
if(z<m-1 && i<=n)
return 0;
else
return 1;
}
int main()
{
int st,dr,mij,d,rasp,i,vf,poz,j;
cin>>n>>d>>m;
for(i=0;i<m;i++){
cin>>v[i].a;
v[i].ind=i+1;
v[i].a+=d;
}
sort(v,v+m,cmp);
st=1;dr=1000000;rasp=mij=0;
while(st<=dr){
mij=(st+dr)/2;
vf=verf(mij);
if(vf==1){
rasp=mij;
dr=mij-1;
}else{
st=mij+1;
}
}
cout<<rasp<<"\n";
poz=0;
for(i=0;i<n;i++){
for(j=0;j<rasp && poz<m;j++){
cout<<v[poz].ind<<" ";
poz++;
}
cout<<"0\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
2 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
3 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
4 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
5 |
Runtime error |
3 ms |
488 KB |
Execution killed with signal 11 |
6 |
Runtime error |
2 ms |
480 KB |
Execution killed with signal 11 |
7 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
8 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
9 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
10 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
11 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
12 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
13 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
14 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
15 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
16 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
17 |
Runtime error |
3 ms |
488 KB |
Execution killed with signal 11 |
18 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
19 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |
20 |
Runtime error |
3 ms |
468 KB |
Execution killed with signal 11 |