QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#416486#8723. 乘二11TL 0ms3652kbC++14485b2024-05-21 21:35:542024-05-21 21:35:55

Judging History

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

  • [2024-05-21 21:35:55]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:3652kb
  • [2024-05-21 21:35:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int p[2000000];
long long n,k;
int b=1000000007,a;
long long sum;
void sss(long long c)
{
	int i=2;
	while(c>p[i])
	{
		i++;
	}
	for(int j=2;j<i;j++)
	{
		p[j-1]=p[j];
	}
	p[i-1]=c;
}
int main ()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>p[i];
		sum+=p[i];
		sum%=b;
		
	}
	sort(p+1,p+1+n);
	for(int i=1;i<=k;i++)
	{
		long long c=2*p[1];
		sum+=p[1];
		sum%=b; 
		sss(c);
	}
	cout<<sum;
}




详细

Test #1:

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

input:

3 3
7 2 1

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: -100
Time Limit Exceeded

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:


result: