結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kotatsugame
提出日時 2017-01-09 01:27:58
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 184 ms / 5,000 ms
コード長 323 bytes
コンパイル時間 461 ms
コンパイル使用メモリ 64,900 KB
実行使用メモリ 144,576 KB
最終ジャッジ日時 2024-06-29 22:22:39
合計ジャッジ時間 2,433 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
bool dp[5001][1<<15];
main()
{
	int n;cin>>n;
	int a[5000];for(int i=0;i<n;i++)cin>>a[i];
	dp[0][0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<1<<15;j++)
		{
			if(dp[i][j])dp[i+1][j^a[i]]=dp[i+1][j]=1;
		}
	}
	int cnt=0;
	for(int j=0;j<1<<15;j++)cnt+=dp[n][j];
	cout<<cnt<<endl;
}
0