結果

問題 No.1299 Random Array Score
ユーザー ytftytft
提出日時 2021-05-22 00:46:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 2,270 bytes
コンパイル時間 5,271 ms
コンパイル使用メモリ 364,292 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 17:13:31
合計ジャッジ時間 6,950 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 73 ms
5,376 KB
testcase_04 AC 71 ms
5,376 KB
testcase_05 AC 55 ms
5,376 KB
testcase_06 AC 52 ms
5,376 KB
testcase_07 AC 53 ms
5,376 KB
testcase_08 AC 71 ms
5,376 KB
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 29 ms
5,376 KB
testcase_11 AC 9 ms
5,376 KB
testcase_12 AC 48 ms
5,376 KB
testcase_13 AC 69 ms
5,376 KB
testcase_14 AC 49 ms
5,376 KB
testcase_15 AC 51 ms
5,376 KB
testcase_16 AC 50 ms
5,376 KB
testcase_17 AC 11 ms
5,376 KB
testcase_18 AC 32 ms
5,376 KB
testcase_19 AC 37 ms
5,376 KB
testcase_20 AC 20 ms
5,376 KB
testcase_21 AC 3 ms
5,376 KB
testcase_22 AC 11 ms
5,376 KB
testcase_23 AC 49 ms
5,376 KB
testcase_24 AC 55 ms
5,376 KB
testcase_25 AC 49 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 13 ms
5,376 KB
testcase_28 AC 10 ms
5,376 KB
testcase_29 AC 16 ms
5,376 KB
testcase_30 AC 47 ms
5,376 KB
testcase_31 AC 17 ms
5,376 KB
testcase_32 AC 70 ms
5,376 KB
testcase_33 AC 79 ms
5,376 KB
testcase_34 AC 28 ms
5,376 KB
testcase_35 AC 80 ms
5,376 KB
testcase_36 AC 26 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <boost/multiprecision/cpp_int.hpp>
typedef boost::multiprecision::cpp_int mp;

template<typename type>
class field{
public:
    function<type(type,type)> add=[](double A,double B){
        return (A+B);
    };
    function<type(type,type)> product=[](double A,double B){
        return (A*B);
    };
    function<bool(type)> in=[this](type a){
        int comp;
        return true;
    };//引数が体の要素か否か
    function<type(type)> add_inverse=[this](type a){
        return -a;
    };
    function<type(type)> product_inverse=[this](type a){
        return 1.0/a;
    };
    type power(type a,mp p){
        type temp=a;
        type ans=one;
        while(p>0){
            if(p%2){
                ans=product(ans,temp);
            }
            p/=2;
            temp=product(temp,temp);
        }
        return ans;
    }
    double one=1.0,zero=0;
    field(string s="real",int param=1000000007){
        if(s=="residue"){
            int MOD=param;
            add=[MOD](int a,int b){
                long long A=a,B=b;
                return (A+B)%MOD;
            };
            product=[MOD](int a,int b){
                long long A=a,B=b;
                return (A*B)%MOD;
            };
            in=[MOD](type a){
                int comp;
                return typeid(comp)==typeid(a) && 0<=a && a<MOD;
            };//引数が体の要素か否か
            add_inverse=[MOD](int a){
                return (-a+MOD)%MOD;
            };
            product_inverse=[MOD](int a){
                long long temp=a;
                long long ans=1;
                int p=MOD-2;
                while(p>0){
                    if(p%2){
                        ans=(ans*temp)%MOD;
                    }
                    temp=(temp*temp)%MOD;
                    p/=2;
                }
                int l=ans;
                return l;
            };
            one=1,zero=0;
        }else if(s=="real"){
        }
    }
};

int main(){
    field<int> f("residue",998244353);
    long long N,K;
    cin>>N>>K;
    int A=0;
    for(int i=0;i<N;i++){
        int temp;
        cin>>temp;
        A+=temp;
        A%=998244353;
    }
    cout<<f.product(A,f.power(2,K))<<endl;
}
0