Submission #7522242


Source Code Expand

Copy
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <cassert>

#pragma GCC optimize("Ofast")
#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

int n, m;
multiset <int> s;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("memory.in", "r", stdin);
	//freopen("memory.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		s.insert(x);
	}
	while (m--)
	{
		int x = *s.rbegin();
		s.erase(s.find(x));
		s.insert(x / 2);
	}
	ll ans = 0;
	while (!s.empty())
	{
		ll x = *s.begin();
		ans += x;
		s.erase(s.begin());
	}
	cout << ans;
	return 0;
}

Submission Info

Submission Time
Task D - Powerful Discount Tickets
User SHAMPINION
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1361 Byte
Status AC
Exec Time 81 ms
Memory 4992 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 7 ms 256 KB
sample_04 AC 1 ms 256 KB
testcase_01 AC 28 ms 3072 KB
testcase_02 AC 18 ms 640 KB
testcase_03 AC 45 ms 4608 KB
testcase_04 AC 64 ms 4992 KB
testcase_05 AC 18 ms 2304 KB
testcase_06 AC 47 ms 4224 KB
testcase_07 AC 8 ms 1280 KB
testcase_08 AC 44 ms 4992 KB
testcase_09 AC 40 ms 3200 KB
testcase_10 AC 16 ms 1152 KB
testcase_11 AC 38 ms 3712 KB
testcase_12 AC 61 ms 4992 KB
testcase_13 AC 17 ms 384 KB
testcase_14 AC 81 ms 4992 KB
testcase_15 AC 62 ms 4992 KB
testcase_16 AC 20 ms 896 KB
testcase_17 AC 1 ms 256 KB
testcase_18 AC 1 ms 256 KB
testcase_19 AC 36 ms 4992 KB