結果
| 問題 |
No.1189 Sum is XOR
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 16:26:48 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 548 bytes |
| コンパイル時間 | 500 ms |
| コンパイル使用メモリ | 66,580 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-15 10:27:10 |
| 合計ジャッジ時間 | 1,861 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 12 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
7 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int N,K;
long dp[11][1<<10];
long cnt[1<<10];
const long mod=998244353;
main()
{
cin>>N>>K;
if(K>10)
{
cout<<0<<endl;
return 0;
}
for(int i=0;i<N;i++)
{
int A;cin>>A;
cnt[A]++;
int T=A&-A;
if(T>1)cnt[A|T-1]++;
}
dp[0][0]=1;
for(int k=0;k<K;k++)
{
for(int i=0;i<1<<10;i++)
{
int T=1023&~i;
int lim=T&-T;
for(int j=T;j>0;j=j-1&T)
{
if(j&lim)(dp[k+1][i|j]+=dp[k][i]*cnt[j])%=mod;
}
}
}
long ans=0;
for(int i=0;i<1<<10;i++)ans+=dp[K][i];
cout<<ans%mod<<endl;
}