結果

問題 No.641 Team Contest Estimation
ユーザー Lepton_sLepton_s
提出日時 2018-01-27 15:10:55
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 543 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 29,196 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-28 09:54:13
合計ジャッジ時間 1,248 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,384 KB
testcase_01 AC 0 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,384 KB
testcase_05 AC 25 ms
4,376 KB
testcase_06 AC 24 ms
4,376 KB
testcase_07 AC 24 ms
4,380 KB
testcase_08 AC 24 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:12:9: 警告: 関数 ‘scanf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   12 |         scanf("%lld%lld", &n, &k);
      |         ^~~~~
main.c:1:1: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | typedef long long ll;
main.c:12:9: 警告: 組み込み関数 ‘scanf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
   12 |         scanf("%lld%lld", &n, &k);
      |         ^~~~~
main.c:12:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:24:25: 警告: 関数 ‘abs’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   24 |                 ll df = abs(n-2*cnt);
      |                         ^~~
main.c:1:1: 備考: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
  +++ |+#include <stdlib.h>
    1 | typedef long long ll;
main.c:24:30: 警告: ‘abs’ argument 1 promotes to ‘ll’ {aka ‘long long int’} where ‘int’ is expected in a call to built-in function declared without prototype [-Wbuiltin-declaration-mismatch]
   24 |                 ll df = abs(n-2*cnt);
      |                             ~^~~~~~
<組み込み>: 備考: built-in ‘abs’ declared here
main.c:27:9: 警告: 関数 ‘printf’ の暗黙的な宣言です [-Wimplicit-function-declaration]
   27 |         printf("%lld\n%lld\n", mu, sg%mod);
      |         ^~~~~~
main.c:27:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:27:9: 警告: 組み込み関数 ‘printf’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
main.c:27:9: 備考: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:15:24: 警告: iteration 249 invokes undefined behavior [-Waggressive-loop-optimizations]
   15 |                 t[i+1] = t[i]<<1;
      |                 ~~~~~~~^~~~~~~~~
main.c:3:36: 備考: within this loop

ソースコード

diff #

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, L){
		t[i+1] = t[i]<<1;
		if(i%2) t[i+1]%=mod;
	}
	rep(i, n) scanf("%lld", a+i);
	ll mu = (t[k*2-1]-t[k-1]+(mod<<1))%mod*n%mod;
	ll sg = 0;
	rep(i, k){
		ll cnt = 0;
		rep(j, n) cnt += (1&(a[j]>>i));
		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