結果
問題 |
No.462 6日知らずのコンピュータ
|
ユーザー |
![]() |
提出日時 | 2017-07-27 17:34:54 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 724 bytes |
コンパイル時間 | 1,877 ms |
コンパイル使用メモリ | 160,208 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-10 02:11:07 |
合計ジャッジ時間 | 3,938 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 63 WA * 21 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 7 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d%d",&N,&K); | ~~~~~^~~~~~~~~~~~~~ main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%lld",&A[i+2]); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> long long fact(int n){ if(!n)return 1; return (n*fact(n-1)%1000000007); } main(){ int N,K; long long A[63],max = 0,sum = 1; scanf("%d%d",&N,&K); A[0] = 0; A[1] = (1LL<<N)-1; for(int i = 0;i < K;i++){ scanf("%lld",&A[i+2]); } std::sort(A,A+K+2); for(int i = 0;i < K+2;i++){ for(int j = 0;j <= 60;j++){ long long b = 1 << j; if((b&max) && !(b&A[i])){ printf("0\n"); return 0; } } max = max|A[i]; } for(int i = 0;i < K+1;i++){ sum = (sum*fact(__builtin_popcount(A[i+1])-__builtin_popcount(A[i])))%1000000007; } printf("%lld\n",sum); }