結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー kotatsugamekotatsugame
提出日時 2017-01-09 01:27:58
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 231 ms / 5,000 ms
コード長 323 bytes
コンパイル時間 458 ms
コンパイル使用メモリ 64,932 KB
実行使用メモリ 144,400 KB
最終ジャッジ日時 2023-09-12 09:40:23
合計ジャッジ時間 3,255 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 212 ms
144,400 KB
testcase_08 AC 204 ms
113,220 KB
testcase_09 AC 141 ms
85,156 KB
testcase_10 AC 180 ms
97,772 KB
testcase_11 AC 226 ms
120,896 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 226 ms
71,760 KB
testcase_15 AC 231 ms
124,216 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 53 ms
39,436 KB
testcase_18 AC 208 ms
136,600 KB
testcase_19 AC 28 ms
20,980 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-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