# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68515 | Bruteforceman | Zalmoxis (BOI18_zalmoxis) | C++11 | 549 ms | 69408 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;
int a[1000010];
vector <int> v[1000010];
int alive[1000010];
int main(int argc, char const *argv[])
{
int n, k;
scanf("%d %d", &n, &k);
for(int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
alive[i] = 1;
v[i].emplace_back(a[i]);
}
int sz = n;
vector <int> can;
for(int i = 0; i < 30; i++) {
can.clear();
for(int j = 1; j <= n; j++) {
if(alive[j]) can.emplace_back(j);
}
int size = can.size();
for(int j = size - 1; j >= 0 && sz <= (n + k); j--) {
if(alive[can[j]] == 0) continue;
if(a[can[j]] == i) {
if(j == 0 || a[can[j - 1]] != i) {
v[can[j]].emplace_back(i);
++a[can[j]];
++sz;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |