結果
| 問題 |
No.641 Team Contest Estimation
|
| コンテスト | |
| ユーザー |
Lepton_s
|
| 提出日時 | 2018-01-27 14:52:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 30 ms / 2,000 ms |
| コード長 | 629 bytes |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 49,920 KB |
| 最終ジャッジ日時 | 2025-01-05 08:01:16 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | 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)
ll a[100000];
ll t[61], tt[61];
int main(){
ll n, k;
scanf("%lld%lld", &n, &k);
t[0] = 1;
rep(i, k) t[i+1] = t[i]*2%mod;
rep(i, k+1) tt[i] = t[i]*t[i]%mod;
rep(i, n) scanf("%lld", a+i);
ll mu = t[k-1]*(t[k]-1)%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);
(df*=df)%=mod;
(df*=tt[i])%=mod;
(df*=tt[k-1])%=mod;
(sg+=df);
}
printf("%lld\n%lld\n", mu, sg%mod);
return 0;
}
Lepton_s