結果
問題 | No.641 Team Contest Estimation |
ユーザー | Lepton_s |
提出日時 | 2018-02-02 15:15:50 |
言語 | C (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 24 ms / 2,000 ms |
コード長 | 547 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 30,208 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-09 21:28:26 |
合計ジャッジ時間 | 1,222 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 0 ms
6,940 KB |
testcase_04 | AC | 0 ms
6,944 KB |
testcase_05 | AC | 21 ms
6,940 KB |
testcase_06 | AC | 22 ms
6,948 KB |
testcase_07 | AC | 22 ms
6,944 KB |
testcase_08 | AC | 24 ms
6,944 KB |
testcase_09 | AC | 1 ms
6,940 KB |
testcase_10 | AC | 1 ms
6,944 KB |
コンパイルメッセージ
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
ソースコード
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; }