結果

問題 No.641 Team Contest Estimation
ユーザー Lepton_s
提出日時 2018-01-27 15:03:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 49,920 KB
最終ジャッジ日時 2025-01-05 08:01:22
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%lld%lld", &n, &k);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
main.cpp:21:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         rep(i, n) scanf("%lld", a+i);
      |                   ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <cmath>
#include <cstdio>
using namespace std;
typedef long long ll;
const ll mod = 1e9+9;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)

#define L 250
ll a[100000];
ll t[L];

int main(){
	ll n, k;
	scanf("%lld%lld", &n, &k);
	t[0] = 1;
	rep(i, k*4){
		t[i+1] = t[i]*2;
		if(i%2) t[i+1]%=mod;
	}
	rep(i, n) scanf("%lld", a+i);
	ll mu = (t[k*2-1]-t[k-1]+mod*4)%mod*n%mod;
	ll sg = 0;
	rep(i, k){
		ll cnt = 0;
		rep(j, n) if(1&(a[j]>>i)) cnt++;
		ll df = abs(n-2*cnt);
		(sg+=df*df%mod*t[(i+k-1)*2]%mod);
	}
	printf("%lld\n%lld\n", mu, sg%mod);
	return 0;
}
0