# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
287802 | rama_pang | Gift (IZhO18_nicegift) | C++14 | 856 ms | 124564 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int N, K;
cin >> N >> K;
lint total = 0;
vector<lint> A(N);
for (int i = 0; i < N; i++) {
cin >> A[i];
total += A[i];
}
if (total % K != 0 || total / K < *max_element(begin(A), end(A))) {
cout << -1 << "\n";
return 0;
}
lint limit = total / K;
vector<lint> sum(K);
vector<vector<pair<lint, int>>> data(K);
for (int i = 0; i < N; i++) {
for (int j = 0; j < K && A[i] > 0; j++) {
if (sum[j] + A[i] <= limit) {
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |