#include <bits/stdc++.h>
using namespace std;
#define int ll
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<pi> vp;
typedef vector<pl> vpl;
int f(int x, int n){
if (x > n){
x %= n;
}
return x;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cerr.tie(nullptr);
int n, k;
cin >> n >> k;
vi a(n);
for (auto& i : a){
cin >> i;
}
if (a[0] %k && n%k) return cout << "0\n", 0;
if (n%k == 0){
cout << n/k << '\n';
for (int i = 1; i <= n; i += k){
cout << a[0] << ' ';
for (int j = i; j < i+k; ++j)
cout << j << ' ';
cout << '\n';
}
return 0;
}
int s = a[0]/k;
cout << n << '\n';
for (int i = 1; i <= n; ++i){
cout << s << ' ';
for (int j = i; j < i+k; ++j){
cout << f(j, n) << ' ';
}
cout << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
342 ms |
22832 KB |
n=1000000 |
2 |
Correct |
202 ms |
14444 KB |
n=666666 |
3 |
Correct |
112 ms |
8428 KB |
n=400000 |
4 |
Correct |
285 ms |
20972 KB |
n=285714 |
5 |
Correct |
6 ms |
876 KB |
n=20000 |
6 |
Correct |
251 ms |
19692 KB |
n=181818 |
7 |
Correct |
5 ms |
620 KB |
n=10000 |
8 |
Incorrect |
2 ms |
492 KB |
Not all heaps are empty in the end |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |