Submission #7563619


Source Code Expand

Copy
#include <bits/stdc++.h>

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  ll N, M;
  cin >> N >> M;
  priority_queue<ll> q;
  rep(i,N) {
    ll x;
    cin >> x;
    q.push(x);
  }
  rep(i,M){
    auto t = q.top(); q.pop();
    q.push(t/2);
  }

  ll ans = 0;
  rep(i,N) {
    ans += q.top(); q.pop();
  }
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task D - Powerful Discount Tickets
User bobuhiro11
Language C++14 (GCC 5.4.1)
Score 400
Code Size 539 Byte
Status
Exec Time 62 ms
Memory 1400 KB

Test Cases

Set Name Score / Max Score Test Cases
All 400 / 400 sample_01, sample_02, sample_03, sample_04, testcase_01, testcase_02, testcase_03, testcase_04, testcase_05, testcase_06, testcase_07, testcase_08, testcase_09, testcase_10, testcase_11, testcase_12, testcase_13, testcase_14, testcase_15, testcase_16, testcase_17, testcase_18, testcase_19
Sample 0 / 0 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 2 ms 256 KB
sample_04 1 ms 256 KB
testcase_01 33 ms 892 KB
testcase_02 13 ms 384 KB
testcase_03 51 ms 1400 KB
testcase_04 62 ms 1400 KB
testcase_05 23 ms 892 KB
testcase_06 50 ms 1400 KB
testcase_07 12 ms 640 KB
testcase_08 52 ms 1400 KB
testcase_09 34 ms 892 KB
testcase_10 13 ms 640 KB
testcase_11 33 ms 1400 KB
testcase_12 52 ms 1400 KB
testcase_13 10 ms 256 KB
testcase_14 52 ms 1400 KB
testcase_15 62 ms 1400 KB
testcase_16 15 ms 512 KB
testcase_17 1 ms 256 KB
testcase_18 1 ms 256 KB
testcase_19 47 ms 1400 KB