#include<bits/stdc++.h>
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef long double ld;
#define SPEED ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0)
#define rall(v) (v).rbegin(),(v).rend()
#define all(v) (v).begin(),(v).end()
#define OK cerr<<"OK"<<endl<<flush
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define F first
#define S second
#define y0 jahdakdh
#define y1 jahsadakdakdh
#define endl '\n'
using namespace std;
const ll MOD=1e9+7;
//mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
int n, d, m;
pii a[1000005];
bool check(int x)
{
int day=1;
while(day<=n)
{
if(day*x>m) break;
//cout<<x<<' ' <<day<<' '<<a[day*x-1].F<<endl;
if(a[day*x-1].F<day) return 0;
day++;
}
return 1;
}
int main()
{
SPEED;
cin>>n>>d>>m;
for(int i=0; i<m; i++)
{
cin>>a[i].F;
a[i].F+=d;
a[i].S=i+1;
}
sort(a, a+m);
int l=1, r=m, mid, pos=0;
while(l<=r)
{
mid=(l+r)>>1;
if(check(mid)) r=mid-1;
else l=mid+1;
}
cout<<l<<endl;
for(int i=0; i<n; i++, cout<<0<<endl)
for(int j=0; j<l and pos<m; j++)
cout<<a[pos++].S<<' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
21 ms |
1612 KB |
Output isn't correct |
2 |
Incorrect |
22 ms |
1712 KB |
Output isn't correct |
3 |
Incorrect |
21 ms |
1620 KB |
Output isn't correct |
4 |
Incorrect |
22 ms |
1604 KB |
Output isn't correct |
5 |
Incorrect |
27 ms |
1680 KB |
Output isn't correct |
6 |
Incorrect |
29 ms |
1664 KB |
Output isn't correct |
7 |
Incorrect |
20 ms |
1636 KB |
Output isn't correct |
8 |
Incorrect |
28 ms |
1656 KB |
Output isn't correct |
9 |
Incorrect |
51 ms |
1980 KB |
Output isn't correct |
10 |
Incorrect |
36 ms |
1780 KB |
Output isn't correct |
11 |
Incorrect |
32 ms |
1620 KB |
Output isn't correct |
12 |
Correct |
74 ms |
3048 KB |
Output is correct |
13 |
Incorrect |
108 ms |
4548 KB |
Output isn't correct |
14 |
Correct |
124 ms |
6120 KB |
Output is correct |
15 |
Incorrect |
164 ms |
7556 KB |
Output isn't correct |
16 |
Correct |
196 ms |
9116 KB |
Output is correct |
17 |
Incorrect |
225 ms |
10524 KB |
Output isn't correct |
18 |
Incorrect |
252 ms |
12076 KB |
Output isn't correct |
19 |
Incorrect |
295 ms |
13744 KB |
Output isn't correct |
20 |
Incorrect |
219 ms |
10564 KB |
Output isn't correct |