QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#416484 | #8723. 乘二 | 11 | TL | 0ms | 3648kb | C++14 | 479b | 2024-05-21 21:34:15 | 2024-05-21 21:34:16 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int p[2000000];
long long n,k;
int b=1000000007,a;
long long sum;
void sss(int 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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3648kb
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...