#include <bits/stdc++.h>
using namespace std;
int N,M,D;
int s[1000001];
bool check(int T){
if(T>=M)return true;
if(T==0)return false;
for(int i=0;i<M;i++)if(s[i]+D<i/T+1)return false;
return true;
}
int main(){
cin>>N>>D>>M;
for(int i=0;i<M;i++)cin>>s[i];
sort(s,s+M);
int x=-1;
for(int b=M;b>=1;b/=2)
while(!check(x+b))x+=b;
cout<<x+1<<endl;
for(int i=0;i<N;i++){
for(int z=i*(x+1);z<M&&z<(i+1)*(x+1);z++)cout<<z+1<<" ";
cout<<0<<endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
1272 KB |
Output isn't correct |
2 |
Incorrect |
79 ms |
1400 KB |
Output isn't correct |
3 |
Incorrect |
78 ms |
1400 KB |
Output isn't correct |
4 |
Incorrect |
78 ms |
1400 KB |
Output isn't correct |
5 |
Incorrect |
78 ms |
1400 KB |
Output isn't correct |
6 |
Incorrect |
78 ms |
1400 KB |
Output isn't correct |
7 |
Incorrect |
79 ms |
1372 KB |
Output isn't correct |
8 |
Incorrect |
78 ms |
1272 KB |
Output isn't correct |
9 |
Partially correct |
316 ms |
1568 KB |
Partially correct |
10 |
Partially correct |
319 ms |
1648 KB |
Partially correct |
11 |
Partially correct |
64 ms |
1272 KB |
Partially correct |
12 |
Partially correct |
125 ms |
2504 KB |
Partially correct |
13 |
Partially correct |
188 ms |
3576 KB |
Partially correct |
14 |
Partially correct |
302 ms |
4672 KB |
Partially correct |
15 |
Incorrect |
301 ms |
5700 KB |
Output isn't correct |
16 |
Partially correct |
436 ms |
6780 KB |
Partially correct |
17 |
Partially correct |
538 ms |
7948 KB |
Partially correct |
18 |
Partially correct |
523 ms |
9012 KB |
Partially correct |
19 |
Partially correct |
810 ms |
10180 KB |
Partially correct |
20 |
Partially correct |
508 ms |
7988 KB |
Partially correct |