結果

問題 No.1560 majority x majority
ユーザー kiyoshi0205kiyoshi0205
提出日時 2021-06-26 00:23:04
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 30,936 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 15:12:14
合計ジャッジ時間 1,707 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,376 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<stdio.h>

unsigned int N,M,cnt[4096],dp[4096];
int main(){
  scanf("%d %d\n",&N,&M);
  for(unsigned int i=0;i<N;++i){
    unsigned int a=0;
    for(unsigned int j=0;j<M;++j){
      char c;
      scanf("%c ",&c);
      a=a<<1|c&1;
    }
    cnt[a]++;
  }
  for(unsigned int i=0;i<12;++i)for(unsigned int j=0;j<4096;++j)if(j>>i&1)cnt[j^(1<<i)]+=cnt[j];
  dp[0]=1;
  for(unsigned int i=0;i<4096;++i){
    for(unsigned int j=0;j<12;++j){
      if(i>>j&1)continue;
      if(cnt[i]<=2*cnt[i|1<<j])dp[i|1<<j]+=dp[i];
    }
  }
  printf("%d\n",dp[(1<<M)-1]);
}
0