# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
378736 |
2021-03-17T03:37:59 Z |
8e7 |
Gift (IZhO18_nicegift) |
C++14 |
|
638 ms |
524288 KB |
//Challenge: Accepted
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <queue>
#define ll long long
#define maxn 1000005
#define pii pair<int, ll>
#define ff first
#define ss second
#define io ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
ll a[maxn];
vector<int> val;
int main() {
io
ll n, k;
cin >> n >> k;
ll m = 0;
for (int i = 0;i < n;i++) {
cin >> a[i];
m += a[i];
for (int j = 0;j < a[i];j++) {
val.push_back(i);
}
}
bool poss = m % k == 0;
for (int i = 0;i < n;i++) {
if (a[i] > m / k) {
poss = false;
break;
}
}
if (!poss) {
cout << -1 << endl;
} else {
cout << m / k << "\n";
for (int i = 0;i < m / k;i++) {
cout << 1 << " ";
for (int j = i;j < m;j += m / k) {
cout << val[j]+1 << " ";
}
cout << "\n";
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
n=4 |
2 |
Correct |
1 ms |
364 KB |
n=3 |
3 |
Correct |
1 ms |
364 KB |
n=3 |
4 |
Correct |
1 ms |
364 KB |
n=4 |
5 |
Correct |
0 ms |
364 KB |
n=4 |
6 |
Correct |
1 ms |
364 KB |
n=2 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
n=4 |
2 |
Correct |
1 ms |
364 KB |
n=3 |
3 |
Correct |
1 ms |
364 KB |
n=3 |
4 |
Correct |
1 ms |
364 KB |
n=4 |
5 |
Correct |
0 ms |
364 KB |
n=4 |
6 |
Correct |
1 ms |
364 KB |
n=2 |
7 |
Correct |
1 ms |
508 KB |
n=5 |
8 |
Correct |
1 ms |
1008 KB |
n=8 |
9 |
Correct |
5 ms |
748 KB |
n=14 |
10 |
Correct |
4 ms |
636 KB |
n=11 |
11 |
Correct |
21 ms |
2028 KB |
n=50000 |
12 |
Correct |
21 ms |
2028 KB |
n=50000 |
13 |
Correct |
16 ms |
1260 KB |
n=10 |
14 |
Correct |
14 ms |
1260 KB |
n=685 |
15 |
Correct |
19 ms |
1388 KB |
n=623 |
16 |
Correct |
10 ms |
1008 KB |
n=973 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
n=4 |
2 |
Correct |
1 ms |
364 KB |
n=3 |
3 |
Correct |
1 ms |
364 KB |
n=3 |
4 |
Correct |
1 ms |
364 KB |
n=4 |
5 |
Correct |
0 ms |
364 KB |
n=4 |
6 |
Correct |
1 ms |
364 KB |
n=2 |
7 |
Correct |
1 ms |
508 KB |
n=5 |
8 |
Correct |
1 ms |
1008 KB |
n=8 |
9 |
Correct |
5 ms |
748 KB |
n=14 |
10 |
Correct |
4 ms |
636 KB |
n=11 |
11 |
Correct |
21 ms |
2028 KB |
n=50000 |
12 |
Correct |
21 ms |
2028 KB |
n=50000 |
13 |
Correct |
16 ms |
1260 KB |
n=10 |
14 |
Correct |
14 ms |
1260 KB |
n=685 |
15 |
Correct |
19 ms |
1388 KB |
n=623 |
16 |
Correct |
10 ms |
1008 KB |
n=973 |
17 |
Correct |
14 ms |
1388 KB |
n=989 |
18 |
Correct |
7 ms |
880 KB |
n=563 |
19 |
Correct |
11 ms |
1260 KB |
n=592 |
20 |
Correct |
14 ms |
1260 KB |
n=938 |
21 |
Correct |
9 ms |
1008 KB |
n=747 |
22 |
Correct |
9 ms |
1132 KB |
n=991 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
638 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
n=4 |
2 |
Correct |
1 ms |
364 KB |
n=3 |
3 |
Correct |
1 ms |
364 KB |
n=3 |
4 |
Correct |
1 ms |
364 KB |
n=4 |
5 |
Correct |
0 ms |
364 KB |
n=4 |
6 |
Correct |
1 ms |
364 KB |
n=2 |
7 |
Correct |
1 ms |
508 KB |
n=5 |
8 |
Correct |
1 ms |
1008 KB |
n=8 |
9 |
Correct |
5 ms |
748 KB |
n=14 |
10 |
Correct |
4 ms |
636 KB |
n=11 |
11 |
Correct |
21 ms |
2028 KB |
n=50000 |
12 |
Correct |
21 ms |
2028 KB |
n=50000 |
13 |
Correct |
16 ms |
1260 KB |
n=10 |
14 |
Correct |
14 ms |
1260 KB |
n=685 |
15 |
Correct |
19 ms |
1388 KB |
n=623 |
16 |
Correct |
10 ms |
1008 KB |
n=973 |
17 |
Correct |
14 ms |
1388 KB |
n=989 |
18 |
Correct |
7 ms |
880 KB |
n=563 |
19 |
Correct |
11 ms |
1260 KB |
n=592 |
20 |
Correct |
14 ms |
1260 KB |
n=938 |
21 |
Correct |
9 ms |
1008 KB |
n=747 |
22 |
Correct |
9 ms |
1132 KB |
n=991 |
23 |
Runtime error |
638 ms |
524288 KB |
Execution killed with signal 9 |
24 |
Halted |
0 ms |
0 KB |
- |