QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#416846 | #8723. 乘二 | char_miii | TL | 0ms | 1560kb | C99 | 558b | 2024-05-22 09:37:05 | 2024-05-22 09:37:07 |
Judging History
answer
#include<stdio.h>
#define MOD 1000000007
long long a[200000];
int main(){
int n,flag=0;
long long k,min=0,sum=0;
scanf("%d%lld",&n,&k);
getchar();
for(int i=0;i<n;i++){
scanf("%lld",&a[i]);
if(a[i]<a[min]) min=i;
}
long long i;
for(i=0;i<k;i++){
a[min]*=2;
min=0;
flag=0;
for(int j=0;j<n;j++){
if(a[j]<a[min]) min=j;
if(a[j]<MOD) flag=1;
}
if(flag==0) break;
}
for(int t=0;t<n;t++){
sum=(sum+a[t])%MOD;
}
for(long long j=0;j<k-i;j+=n){
sum=(sum*2)%MOD;
}
printf("%lld",sum);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1560kb
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...