QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#602577 | #8723. 乘二 | liguo# | WA | 26ms | 4740kb | C++20 | 1.0kb | 2024-10-01 10:53:03 | 2024-10-01 10:53:04 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mn=1e9+7;
template<typename T>
using v =vector<T>;
using v_=v<int>;
int pow_mod(int base,int exp){
int ans=1;
for(;exp;exp>>=1){
if(exp&1)(ans*=base)%=mn;
(base*=base)%=mn;
}
return ans;
}
signed main(){
ios::sync_with_stdio(false);
int n,k;
cin>>n>>k;
v_ in(n);
for(int &i:in)cin>>i;
ranges::sort(in);
while(true){
int i=0;
for(;i<n;i++){
if(k==0)break;
if(i==0 || in[i]<in[i-1]){
in[i]*=2;
k--;
}else{
break;
}
}
ranges::inplace_merge(in,in.begin()+i);
if(k==0||i==n)break;
}
auto [q,r]=div(k,n);
cerr<<format("q:{} r:{}\n",q,r);
cout<<(
reduce(in.begin(),in.begin()+r,0ll)%mn*pow_mod(2,q+1)+
reduce(in.begin()+r,in.end(),0ll)%mn*pow_mod(2,q)
)%mn;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3672kb
input:
3 3 7 2 1
output:
15
result:
ok 1 number(s): "15"
Test #2:
score: -100
Wrong Answer
time: 26ms
memory: 4740kb
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:
33299264
result:
wrong answer 1st numbers differ - expected: '707034173', found: '33299264'