// Wael Benslimene DrStonee
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
const long long mod=1e9+7;
const long long MOD=998244353;
#define ll long long
#define endl '\n'
#define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ff first
#define ss second
#define INF 1e18+5
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
ll binpow(ll a,ll b){ll res=1;while(b>0){if(b&1)res=(res*a);a=((a)*(a));b/=2;}return res;}
ll gcd(ll a,ll b){return b==0 ? a:gcd(b,a%b);}
ll lcm(ll a,ll b){return (a/gcd(a,b))*b;}
const int N=1e5+1;
vector<int> v[N],a[N];
void solve()
{
int n,d,m;cin>>n>>d>>m;
for(int i=1,x;i<=m;i++)
{
cin>>x;
v[x].pb(i);
}
int j=1,ans=0;
for(int i=1;i<=n;i++)
{
while(!v[i].empty())
{
if(j>d+i)j=i;
if(j<i)j=i;
a[j].pb(v[i].back());
ans=max(ans,(int)a[j].size());
v[i].pop_back();
j++;
}
}
cout<<ans<<endl;
for(int i=1;i<=n;i++)
{
for(auto x:a[i])
{
cout<<x<<" ";
}
cout<<0<<endl;
}
}
int main()
{
FAST;
int t=1;
// cin>>t;
while(t--)
{
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
7128 KB |
Output is correct |
2 |
Correct |
11 ms |
7132 KB |
Output is correct |
3 |
Correct |
11 ms |
7132 KB |
Output is correct |
4 |
Correct |
11 ms |
7384 KB |
Output is correct |
5 |
Correct |
11 ms |
7144 KB |
Output is correct |
6 |
Correct |
20 ms |
7128 KB |
Output is correct |
7 |
Correct |
11 ms |
7132 KB |
Output is correct |
8 |
Correct |
10 ms |
7128 KB |
Output is correct |
9 |
Incorrect |
19 ms |
7140 KB |
Output isn't correct |
10 |
Incorrect |
16 ms |
7184 KB |
Output isn't correct |
11 |
Incorrect |
12 ms |
7028 KB |
Output isn't correct |
12 |
Incorrect |
26 ms |
9140 KB |
Output isn't correct |
13 |
Incorrect |
34 ms |
12404 KB |
Output isn't correct |
14 |
Incorrect |
55 ms |
14528 KB |
Output isn't correct |
15 |
Incorrect |
59 ms |
15652 KB |
Output isn't correct |
16 |
Incorrect |
82 ms |
18516 KB |
Output isn't correct |
17 |
Incorrect |
88 ms |
23416 KB |
Output isn't correct |
18 |
Incorrect |
98 ms |
22132 KB |
Output isn't correct |
19 |
Incorrect |
117 ms |
23376 KB |
Output isn't correct |
20 |
Incorrect |
89 ms |
23376 KB |
Output isn't correct |