#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define ll long long
struct P{
ll x, y;
};
void dbg_out() { cerr << endl; }
template <typename H, typename... T>
void dbg_out(H h, T... t) { cerr << ' ' << h; dbg_out(t...); }
#define dbg(...) { cerr << #__VA_ARGS__ << ':'; dbg_out(__VA_ARGS__); }
signed main(){
fastio;
int n, d, m;
cin >> n >> d >> m;
vector<pair<int, int>> arr (m);
for (int i=1, x; i<=m; i++){
cin >> x;
arr[i-1] = {x, i};
}
sort(all(arr));
int pcs=1;
for (int i=0; i<m; i++){
while ((i+pcs)/pcs > arr[i].first+d) pcs++;
}
cout << pcs << '\n';
int j=0;
for (int i=0; i<n; i++){
for (int k=0; k<pcs && j<m; k++, j++){
cout << arr[j].second << ' ';
}
cout << 0 << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
14 ms |
2140 KB |
Output isn't correct |
2 |
Incorrect |
14 ms |
2136 KB |
Output isn't correct |
3 |
Incorrect |
14 ms |
2140 KB |
Output isn't correct |
4 |
Incorrect |
14 ms |
2140 KB |
Output isn't correct |
5 |
Incorrect |
14 ms |
2140 KB |
Output isn't correct |
6 |
Incorrect |
15 ms |
2140 KB |
Output isn't correct |
7 |
Incorrect |
14 ms |
2132 KB |
Output isn't correct |
8 |
Incorrect |
20 ms |
2136 KB |
Output isn't correct |
9 |
Correct |
24 ms |
2140 KB |
Output is correct |
10 |
Correct |
24 ms |
2128 KB |
Output is correct |
11 |
Correct |
24 ms |
2140 KB |
Output is correct |
12 |
Correct |
40 ms |
3968 KB |
Output is correct |
13 |
Correct |
60 ms |
5860 KB |
Output is correct |
14 |
Correct |
88 ms |
8068 KB |
Output is correct |
15 |
Incorrect |
102 ms |
9588 KB |
Output isn't correct |
16 |
Correct |
127 ms |
12116 KB |
Output is correct |
17 |
Correct |
150 ms |
13908 KB |
Output is correct |
18 |
Correct |
168 ms |
15188 KB |
Output is correct |
19 |
Correct |
189 ms |
17124 KB |
Output is correct |
20 |
Correct |
149 ms |
13920 KB |
Output is correct |