結果
問題 |
No.641 Team Contest Estimation
|
ユーザー |
![]() |
提出日時 | 2018-01-27 14:58:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 26 ms / 2,000 ms |
コード長 | 571 bytes |
コンパイル時間 | 566 ms |
コンパイル使用メモリ | 49,536 KB |
最終ジャッジ日時 | 2025-01-05 08:01:19 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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:18:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 18 | rep(i, n) scanf("%lld", a+i); | ~~~~~^~~~~~~~~~~~~
ソースコード
#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 300 ll a[100000]; ll t[L]; int main(){ ll n, k; scanf("%lld%lld", &n, &k); t[0] = 1; rep(i, L-1) t[i+1] = t[i]*2%mod; rep(i, n) scanf("%lld", a+i); ll mu = (t[k*2-1]-t[k-1]+mod)%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; }