#define wiwihorz
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define ceil(a, b) ((a + b - 1) / (b))
#define all(x) x.begin(), x.end()
#define INF 1000000000000000000
#define MOD 1000000007
#define eps (1e-9)
#define MAXN 1000005
#define int long long int
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
using namespace std;
#ifdef wiwihorz
#define print(a...) kout("[" + string(#a) + "] = ", a...)
void vprint(auto L, auto R) {
while(L < R) cerr << *L << " \n"[next(L) == R], ++ L;
}
void kout() {cerr << endl;}
template<class T1, class ... T2> void kout(T1 a, T2 ... e) {
cerr << a << " ", kout(e...);
}
#else
#define print(...) 0
#define vprint(...) 0
#endif
struct sb4 {
int n, k;
vector<int> a;
void init_(int _n, int _k) {
n = _n, k = _k;
a.assign(n + 1, 0);
}
void solve() {
if(n % k) {
cout << "-1\n";
return;
}
cout << n / k << "\n";
rep(i, 1, n / k) {
cout << a[1];
rep(j, (i - 1) * k + 1, i * k) {
cout << " " << j;
}
cout << "\n";
}
}
} ac;
signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int n, k; cin >> n >> k;
ac.init_(n, k);
rep(i, 1, n) cin >> ac.a[i];
ac.solve();
return 0;
}
Compilation message
nicegift.cpp:4: warning: ignoring #pragma loop [-Wunknown-pragmas]
4 | #pragma loop-opt(on)
|
nicegift.cpp:24:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts'
24 | void vprint(auto L, auto R) {
| ^~~~
nicegift.cpp:24:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts'
24 | void vprint(auto L, auto R) {
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
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 |
321 ms |
22124 KB |
n=1000000 |
2 |
Correct |
196 ms |
22380 KB |
n=666666 |
3 |
Correct |
110 ms |
12780 KB |
n=400000 |
4 |
Incorrect |
47 ms |
6508 KB |
Jury has the answer but participant has not |
5 |
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 |
- |