結果
問題 | No.1299 Random Array Score |
ユーザー |
![]() |
提出日時 | 2021-05-22 00:46:31 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 2,270 bytes |
コンパイル時間 | 3,862 ms |
コンパイル使用メモリ | 364,140 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-10 10:31:17 |
合計ジャッジ時間 | 7,603 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#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;}