#include<iostream>
#include<stdio.h>
#include<math.h>
#include<map>
#include<string>
#include<algorithm>
#include<vector>
#include<string.h>
#include<utility>
#include<set>
#include<cmath>
#include<queue>
#include<deque>
#include<functional>
#include<stack>
#include<limits.h>
#include<iomanip>
#include<unordered_map>
#include<numeric>
#include<tuple>
#include<bitset>
using namespace std;
#define MOD 1000000007
#define int long long
#define ss second
#define ff first
#define endl '\n'
signed main(){
// freopen("file.in", "r", stdin);
// freopen("file.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,d,m; cin>>n>>d>>m;
vector<pair<int,int> > a(m+1);
for(int i=1; i<=m; i++) cin>>a[i].ff,a[i].ss=i;
sort(a.begin(),a.end());
int l=1,r=m;
while(l<=r){
int mid=l+(r-l)/2;
bool ok=1;
for(int i=mid,j=1; i<=m; i+=min(mid,m-i),j++){
if(j>a[i].ff+d) ok=0;
if(i==m) break;
}
if(ok) r=mid-1;
else l=mid+1;
}
cout<<l<<endl;
for(int i=1,j=1; i<=n; i++){
while(j<=m){
cout<<a[j].ss<<' ';
if(j++%l==0) break;
}
cout<<0<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
2908 KB |
Output isn't correct |
2 |
Incorrect |
13 ms |
2908 KB |
Output isn't correct |
3 |
Incorrect |
14 ms |
2936 KB |
Output isn't correct |
4 |
Incorrect |
15 ms |
2788 KB |
Output isn't correct |
5 |
Incorrect |
18 ms |
2908 KB |
Output isn't correct |
6 |
Incorrect |
13 ms |
2908 KB |
Output isn't correct |
7 |
Incorrect |
13 ms |
2848 KB |
Output isn't correct |
8 |
Incorrect |
13 ms |
2904 KB |
Output isn't correct |
9 |
Correct |
23 ms |
2908 KB |
Output is correct |
10 |
Correct |
23 ms |
2904 KB |
Output is correct |
11 |
Incorrect |
19 ms |
2928 KB |
Output isn't correct |
12 |
Correct |
39 ms |
5636 KB |
Output is correct |
13 |
Incorrect |
58 ms |
8276 KB |
Output isn't correct |
14 |
Correct |
83 ms |
11088 KB |
Output is correct |
15 |
Incorrect |
98 ms |
13396 KB |
Output isn't correct |
16 |
Correct |
122 ms |
16724 KB |
Output is correct |
17 |
Incorrect |
150 ms |
19464 KB |
Output isn't correct |
18 |
Correct |
159 ms |
21332 KB |
Output is correct |
19 |
Correct |
186 ms |
24264 KB |
Output is correct |
20 |
Incorrect |
145 ms |
19540 KB |
Output isn't correct |