#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pld pair<ld, ld>
#define pb push_back
#define fi first
#define se second
#define debug(x) cout << #x << " => " << x << endl
#define all(x) x.begin(),x.end()
int n,d,m;
pii a[1000010];
bool ok(int x)
{
int t=0,i=0,cnt=0,mx=0;
while(i<m)
{
while(cnt!=x && a[i].fi<=t) i++,cnt++,mx=max(mx,t+d);
cnt=0;
t++;
}
return mx<=n;
}
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
cin>>n>>d>>m;
for(int i=0;i<m;i++) cin>>a[i].fi;
for(int i=0;i<m;i++) a[i].se=i;
sort(a,a+m);
int l=1,r=n,ans=1;
while(l<r)
{
int mid=(l+r)/2;
if(ok(mid)) r=mid-1,ans=mid;
else l=mid+1;
}
cout<<ans<<'\n';
int t=1,i=0,cnt=0;
while(i<m)
{
while(cnt!=ans && a[i].fi<=t)
{
cout<<a[i].se+1<<' ';
i++,cnt++;
}
cnt=0;
t++;
cout<<"0\n";
}
cout<<"0\n0\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
10 ms |
3420 KB |
Output isn't correct |
2 |
Incorrect |
10 ms |
3420 KB |
Output isn't correct |
3 |
Incorrect |
9 ms |
3420 KB |
Output isn't correct |
4 |
Incorrect |
10 ms |
3420 KB |
Output isn't correct |
5 |
Incorrect |
11 ms |
3572 KB |
Output isn't correct |
6 |
Incorrect |
10 ms |
3420 KB |
Output isn't correct |
7 |
Incorrect |
9 ms |
3500 KB |
Output isn't correct |
8 |
Incorrect |
10 ms |
3420 KB |
Output isn't correct |
9 |
Incorrect |
16 ms |
3428 KB |
Output isn't correct |
10 |
Incorrect |
19 ms |
3672 KB |
Output isn't correct |
11 |
Incorrect |
15 ms |
3420 KB |
Output isn't correct |
12 |
Incorrect |
30 ms |
4692 KB |
Output isn't correct |
13 |
Incorrect |
46 ms |
7764 KB |
Output isn't correct |
14 |
Incorrect |
63 ms |
9212 KB |
Output isn't correct |
15 |
Incorrect |
76 ms |
9812 KB |
Output isn't correct |
16 |
Incorrect |
97 ms |
13648 KB |
Output isn't correct |
17 |
Incorrect |
117 ms |
14928 KB |
Output isn't correct |
18 |
Incorrect |
127 ms |
15188 KB |
Output isn't correct |
19 |
Incorrect |
146 ms |
17104 KB |
Output isn't correct |
20 |
Incorrect |
112 ms |
14964 KB |
Output isn't correct |