# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41626 | cheater2k | Gift (IZhO18_nicegift) | C++14 | 1227 ms | 110188 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;
const int N = 1000005;
int n, k;
long long a[N];
long long sum;
long long mx;
priority_queue < pair<long long, int> > pq;
vector < vector <int> > vres;
vector <long long> vX;
int main() {
ios_base::sync_with_stdio(false); cin.tie(0);
cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> a[i], sum += a[i]; mx = max(mx, a[i]);
}
if (sum % k != 0 || mx > sum / k) return printf("-1\n"), 0;
for (int i = 1; i <= n; ++i) {
pq.push(make_pair(a[i], i));
}
long long average = sum / k;
while(!pq.empty()) {
int taken = 0;
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... |