結果

問題 No.641 Team Contest Estimation
ユーザー Lepton_s
提出日時 2018-02-02 15:15:50
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 30,592 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 00:32:54
合計ジャッジ時間 1,331 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:12:9: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
   12 |         scanf("%lld%lld", &n, &k);
      |         ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
  +++ |+#include <stdio.h>
    1 | typedef long long ll;
main.c:12:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
   12 |         scanf("%lld%lld", &n, &k);
      |         ^~~~~
main.c:12:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:24:25: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   24 |                 ll df = abs(n-2*cnt);
      |                         ^~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
  +++ |+#include <stdlib.h>
    1 | typedef long long ll;
main.c:24:30: warning: '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>: note: built-in 'abs' declared here
main.c:27:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   27 |         printf("%d\n%d\n", mu, (int)(sg%mod));
      |         ^~~~~~
main.c:27:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:27:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:27:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:15:24: warning: iteration 249 invokes undefined behavior [-Waggressive-loop-optimizations]
   15 |                 t[i+1] = t[i]<<1;
      |                 ~~~~~~~^~~~~~~~~
main.c:3:36: note: within this loop
    3 | #define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
      |                                 ~~~^~~~~~~~
main.c

ソースコード

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);
int 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("%d\n%d\n", mu, (int)(sg%mod));
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0