# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
407385 |
2021-05-18T20:44:57 Z |
arayi |
Gift (IZhO18_nicegift) |
C++17 |
|
1089 ms |
23748 KB |
//Arayi
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#include <chrono>
#include <random>
#include <complex>
#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jigglypuff
#define ld long double
#define itn int
#define pir pair<int, int>
#define all(x) (x).begin(), (x).end()
#define str string
#define enl endl
#define en endl
#define cd complex<long double>
#define vcd vector<cd>
#define vii vector<int>
#define vlli vector<lli>
using namespace std;
lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x, ld y1, ld x2, ld y2)
{
return sqrt((x - x2) * (x - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
return (a * (a + 1LL)) / 2;
}
mt19937 rnd(363542);
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 0, -1, 0, 1, -1, -1, 1, 1, 0 };
int dy[] = { -1, 0, 1, 0, -1, 1, -1, 1, 0 };
const int N = 5e6 + 30;
const lli mod = 1e9 + 7;
const ld pi = acos(-1);
const ld e = log2(3);
const int T = 1000;
lli bp(lli a, lli b = mod - 2LL)
{
lli ret = 1;
while (b)
{
if (b & 1) ret *= a, ret %= mod;
a *= a;
a %= mod;
b >>= 1;
}
return ret;
}
ostream& operator<<(ostream& c, pir a)
{
c << a.fr << " " << a.sc;
return c;
}
template<class T>
void maxi(T& a, T b)
{
a = max(a, b);
}
template <class T>
void mini(T& a, T b)
{
a = min(a, b);
}
int n;
lli a[N], sum, k;
int main()
{
fastio;
cin >> n >> k;
for (int i = 0; i < n; i++)
{
cin >> a[i];
sum += a[i];
}
if (sum % k) return cout << -1 << endl, 0;
lli s = n * k / gcd(k, n); s = sum / s;
int i1 = 0;
cout << sum / s / k << endl;
for (int i = 0; i < sum / s / k; i++)
{
cout << s << " ";
for (int j = 0; j < k; j++)
{
cout << 1 + i1++ << " ";
i1 %= n;
}
cout << endl;
}
return 0;
}
/*
__
*(><)*
\/ /
||/
--||
||
/\
/ \
/ \
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1089 ms |
22484 KB |
n=1000000 |
2 |
Correct |
543 ms |
22488 KB |
n=666666 |
3 |
Correct |
237 ms |
12756 KB |
n=400000 |
4 |
Correct |
712 ms |
23748 KB |
n=285714 |
5 |
Correct |
6 ms |
844 KB |
n=20000 |
6 |
Correct |
515 ms |
19556 KB |
n=181818 |
7 |
Correct |
4 ms |
588 KB |
n=10000 |
8 |
Correct |
37 ms |
1980 KB |
n=6666 |
9 |
Correct |
2 ms |
332 KB |
n=4000 |
10 |
Correct |
210 ms |
9660 KB |
n=2857 |
11 |
Correct |
1 ms |
332 KB |
n=2000 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Not all heaps are empty in the end |
2 |
Halted |
0 ms |
0 KB |
- |