#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<max(s[i],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 |
79 ms |
1272 KB |
Output isn't correct |
2 |
Incorrect |
80 ms |
1420 KB |
Output isn't correct |
3 |
Incorrect |
81 ms |
1360 KB |
Output isn't correct |
4 |
Incorrect |
79 ms |
1296 KB |
Output isn't correct |
5 |
Incorrect |
79 ms |
1272 KB |
Output isn't correct |
6 |
Incorrect |
80 ms |
1340 KB |
Output isn't correct |
7 |
Incorrect |
81 ms |
1272 KB |
Output isn't correct |
8 |
Incorrect |
80 ms |
1388 KB |
Output isn't correct |
9 |
Partially correct |
318 ms |
1528 KB |
Partially correct |
10 |
Partially correct |
317 ms |
1548 KB |
Partially correct |
11 |
Partially correct |
64 ms |
1400 KB |
Partially correct |
12 |
Partially correct |
126 ms |
2480 KB |
Partially correct |
13 |
Partially correct |
185 ms |
3448 KB |
Partially correct |
14 |
Partially correct |
305 ms |
4600 KB |
Partially correct |
15 |
Incorrect |
306 ms |
5712 KB |
Output isn't correct |
16 |
Partially correct |
444 ms |
6776 KB |
Partially correct |
17 |
Partially correct |
519 ms |
7820 KB |
Partially correct |
18 |
Partially correct |
618 ms |
9056 KB |
Partially correct |
19 |
Partially correct |
835 ms |
10384 KB |
Partially correct |
20 |
Partially correct |
527 ms |
7916 KB |
Partially correct |