QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#602569#8723. 乘二liguo#WA 24ms4736kbC++201023b2024-10-01 10:49:492024-10-01 10:49:49

Judging History

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

  • [2024-10-01 10:49:49]
  • 评测
  • 测评结果:WA
  • 用时:24ms
  • 内存:4736kb
  • [2024-10-01 10:49:49]
  • 提交

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;
            }
        }
        if(k==0||i==n)break;
        ranges::inplace_merge(in,in.begin()+i);
    }
    auto [q,r]=div(k,n);
    cerr<<format("q:{} r:{}\n",q,r);
    cout<<(
        reduce(in.begin(),in.begin()+r,0ll)*pow_mod(2,q+1)+
        reduce(in.begin()+r,in.end(),0ll)*pow_mod(2,q)
            )%mn;

}


詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3620kb

input:

3 3
7 2 1

output:

15

result:

ok 1 number(s): "15"

Test #2:

score: -100
Wrong Answer
time: 24ms
memory: 4736kb

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'