結果

問題 No.641 Team Contest Estimation
ユーザー chocoruskchocorusk
提出日時 2019-10-26 13:58:24
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 92 ms / 2,000 ms
コード長 1,131 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 109,196 KB
実行使用メモリ 4,352 KB
最終ジャッジ日時 2023-10-12 08:12:02
合計ジャッジ時間 2,501 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 92 ms
4,348 KB
testcase_06 AC 92 ms
4,348 KB
testcase_07 AC 92 ms
4,348 KB
testcase_08 AC 92 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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_popcount
using 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;
}
0