QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#422917#8723. 乘二smallteaseWA 161ms10808kbC++17609b2024-05-27 20:15:012024-05-27 20:15:02

Judging History

你现在查看的是最新测评结果

  • [2024-05-27 20:15:02]
  • 评测
  • 测评结果:WA
  • 用时:161ms
  • 内存:10808kb
  • [2024-05-27 20:15:01]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int N = 2010;
void solve() {
	int n,k;
	ll ans = 0;
	cin >> n>>k;
	map<ll, ll>p;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		ans += a;
		p[a]++;
	}
	while (k--)
	{
		map<ll, ll>::iterator it = p.begin();
		//it--;
		ll t = it->first;
		p[t]--; p[(ll)2 * t]++;
		if (p[t] == 0)p.erase(t);
		ans += t;

	}
	cout << ans << endl;
}
int main() {
	ios::sync_with_stdio(0); cin.tie();
	int T=1;
	//cin >> T;
	while (T--)
	{
		solve();
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3540kb

input:

3 3
7 2 1

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: -100
Wrong Answer
time: 161ms
memory: 10808kb

input:

200000 1605067
366760624 67854 93901 693975 27016 1046 10808 6533158 54778 500941023 77236442 32173 10431454 2 9726 1553148 89282 411182309 494073 131299543 249904771 7906930 353 9909 3632698 29156 1917186 303 737 1189004 22 1983 263 711 4106258 2070 36704 12524642 5192 123 2061 22887 66 380 1 10153...

output:

10953707110844

result:

wrong answer 1st numbers differ - expected: '707034173', found: '10953707110844'