Submission #7908520


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N, M;
    cin >> N >> M;
    priority_queue<int> pq;
    rep(i, 0, N) {
        int x;
        cin >> x;
        pq.push(x);
    }
    rep(i, 0, M) {
        int x = pq.top(); pq.pop();
        pq.push(x / 2);
    }
    int ans = 0;
    while (sz(pq)) {
        int x = pq.top(); pq.pop();
        ans += x;
    }
    cout << ans << endl;
    return (0^_^0);
}

Submission Info

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

Judge Result

Set Name All Sample
Score / Max Score 400 / 400 0 / 0
Status
AC × 23
AC × 4
Set Name Test Cases
All 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 sample_01, sample_02, sample_03, sample_04
Case Name Status Exec Time Memory
sample_01 AC 1 ms 256 KB
sample_02 AC 1 ms 256 KB
sample_03 AC 2 ms 256 KB
sample_04 AC 1 ms 256 KB
testcase_01 AC 15 ms 892 KB
testcase_02 AC 11 ms 384 KB
testcase_03 AC 24 ms 1400 KB
testcase_04 AC 33 ms 1400 KB
testcase_05 AC 10 ms 892 KB
testcase_06 AC 25 ms 1400 KB
testcase_07 AC 5 ms 640 KB
testcase_08 AC 23 ms 1400 KB
testcase_09 AC 22 ms 892 KB
testcase_10 AC 9 ms 640 KB
testcase_11 AC 21 ms 1400 KB
testcase_12 AC 32 ms 1400 KB
testcase_13 AC 9 ms 384 KB
testcase_14 AC 20 ms 1400 KB
testcase_15 AC 33 ms 1400 KB
testcase_16 AC 12 ms 512 KB
testcase_17 AC 1 ms 256 KB
testcase_18 AC 1 ms 256 KB
testcase_19 AC 15 ms 1400 KB