Submission #844070

# Submission time Handle Problem Language Result Execution time Memory
844070 2023-09-05T06:20:25 Z GrandTiger1729 Gift (IZhO18_nicegift) C++17
0 / 100
353 ms 89836 KB
#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 < n * K; 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] / K << ' ';
        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 353 ms 89836 KB n=1000000
2 Incorrect 293 ms 73776 KB Not all heaps are empty in the end
3 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 -