#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;
int j=0;
for(int i=0;i<N;i++){
for(int z=0;z<x+1&&j+z<M;z++)cout<<j+z<<" ";
cout<<0<<endl;
j+=x+1;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
79 ms |
1400 KB |
Output isn't correct |
2 |
Incorrect |
79 ms |
1400 KB |
Output isn't correct |
3 |
Incorrect |
78 ms |
1372 KB |
Output isn't correct |
4 |
Incorrect |
78 ms |
1452 KB |
Output isn't correct |
5 |
Incorrect |
78 ms |
1272 KB |
Output isn't correct |
6 |
Incorrect |
78 ms |
1400 KB |
Output isn't correct |
7 |
Incorrect |
81 ms |
1272 KB |
Output isn't correct |
8 |
Incorrect |
80 ms |
1272 KB |
Output isn't correct |
9 |
Incorrect |
317 ms |
1588 KB |
Expected EOLN |
10 |
Incorrect |
318 ms |
1528 KB |
Expected EOLN |
11 |
Incorrect |
64 ms |
1272 KB |
Expected EOLN |
12 |
Incorrect |
124 ms |
2424 KB |
Expected EOLN |
13 |
Incorrect |
182 ms |
3448 KB |
Expected EOLN |
14 |
Incorrect |
301 ms |
4684 KB |
Expected EOLN |
15 |
Incorrect |
307 ms |
5612 KB |
Output isn't correct |
16 |
Incorrect |
438 ms |
6904 KB |
Expected EOLN |
17 |
Incorrect |
512 ms |
7932 KB |
Expected EOLN |
18 |
Incorrect |
526 ms |
8952 KB |
Expected EOLN |
19 |
Incorrect |
817 ms |
10360 KB |
Expected EOLN |
20 |
Incorrect |
513 ms |
7916 KB |
Expected EOLN |