# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1133214 | Halym2007 | Gift (IZhO18_nicegift) | C++17 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sz size()
#define ff first
#define ss second
#define pb push_back
#define pii pair <int, int>
#define dur exit(0)
#define dur1 return(0)
const int N = 1e6 + 5;
ll n, k, a[N];
vector <ll> v;
int main () {
// freopen ("input.txt", "r", stdin);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
}
if (n % k == 0 and a[i] >= 0) {
if (a[1] == 0) {
cout << "0\n";
return 0;
}
cout << n / k << "\n";
for (int i = 1; i <= n; ++i) {
if (i % k == 1) {
cout << "\n";
cout << a[1] << " ";
}
cout << i << " ";
}
}
else {
cout << "-1\n";
}
}