#include <bits/stdc++.h>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int n, K; cin >> n >> K;
vector<long long> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
if (a[0] * n % K != 0)
{
cout << -1 << '\n';
return 0;
}
vector<vector<int>> ans;
for (int i = 0; !(i != 0 && i % n == 0); i += K)
{
ans.emplace_back();
for (int j = i; j < i + K; j++)
ans.back().emplace_back(j % n);
}
cout << ans.size() << '\n';
for (auto &vec : ans)
{
cout << a[0] * n / K / ans.size() << ' ';
for (int j = 0; j < K; j++)
cout << vec[j] + 1 << " \n"[j == K - 1];
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
49644 KB |
n=1000000 |
2 |
Correct |
145 ms |
26068 KB |
n=666666 |
3 |
Correct |
82 ms |
18688 KB |
n=400000 |
4 |
Correct |
196 ms |
45348 KB |
n=285714 |
5 |
Correct |
3 ms |
1116 KB |
n=20000 |
6 |
Correct |
162 ms |
38380 KB |
n=181818 |
7 |
Correct |
2 ms |
604 KB |
n=10000 |
8 |
Correct |
20 ms |
4444 KB |
n=6666 |
9 |
Correct |
1 ms |
348 KB |
n=4000 |
10 |
Correct |
121 ms |
21396 KB |
n=2857 |
11 |
Correct |
1 ms |
500 KB |
n=2000 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |