結果
問題 | No.641 Team Contest Estimation |
ユーザー |
![]() |
提出日時 | 2019-10-26 13:58:24 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 96 ms / 2,000 ms |
コード長 | 1,131 bytes |
コンパイル時間 | 955 ms |
コンパイル使用メモリ | 109,404 KB |
実行使用メモリ | 6,812 KB |
最終ジャッジ日時 | 2024-09-14 07:18:27 |
合計ジャッジ時間 | 2,838 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 |
ソースコード
#include <cstdio>#include <cstring>#include <iostream>#include <string>#include <cmath>#include <bitset>#include <vector>#include <map>#include <set>#include <queue>#include <deque>#include <algorithm>#include <complex>#include <unordered_map>#include <unordered_set>#include <random>#include <cassert>#include <fstream>#include <utility>#include <functional>#include <time.h>#include <stack>#define popcount __builtin_popcountusing namespace std;typedef long long int ll;typedef pair<int, int> P;const ll MOD=1e9+9;int main(){int n, k;cin>>n>>k;ll x[61]={};for(int i=0; i<n; i++){ll a; cin>>a;for(int j=0; j<k; j++){if(a&(1ll<<j)) x[j]++;}}ll p=(1ll<<k)%MOD, p1=(1ll<<(k-1))%MOD;ll ans1=(p-1)*n%MOD*p1%MOD;cout<<ans1<<endl;ll ans2=0;for(int i=0; i<k; i++){ll p2=(1ll<<i)%MOD;(ans2+=(x[i]*x[i]+(n-x[i])*(n-x[i]))%MOD*p2%MOD*p2)%=MOD;}ans2=ans2*p%MOD*p1%MOD;ans2+=MOD-(ll)n*n%MOD*p1%MOD*p1%MOD*(p*p%MOD-1)%MOD*((2*MOD+1)/3)%MOD;ans2%=MOD;cout<<ans2<<endl;return 0;}