結果
| 問題 | 
                            No.183 たのしい排他的論理和(EASY)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             fiord
                         | 
                    
| 提出日時 | 2015-07-08 22:27:37 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                RE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 356 bytes | 
| コンパイル時間 | 1,079 ms | 
| コンパイル使用メモリ | 159,132 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-07-08 01:44:53 | 
| 合計ジャッジ時間 | 4,440 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | RE * 2 | 
| other | RE * 18 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:48: warning: iteration 16384 invokes undefined behavior [-Waggressive-loop-optimizations]
    7 |         for(int i=0;i<(1<<15);i++)      data[i]=false;
      |                                         ~~~~~~~^~~~~~
main.cpp:7:22: note: within this loop
    7 |         for(int i=0;i<(1<<15);i++)      data[i]=false;
      |                     ~^~~~~~~~
main.cpp:7:48: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ writing 32768 bytes into a region of size 16384 overflows the destination [-Wstringop-overflow=]
    7 |         for(int i=0;i<(1<<15);i++)      data[i]=false;
      |                                         ~~~~~~~^~~~~~
main.cpp:6:14: note: destination object ‘data’ of size 16384
    6 |         bool data[1<<14];
      |              ^~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n;	cin>>n;
	int a;
	bool data[1<<14];
	for(int i=0;i<(1<<15);i++)	data[i]=false;
	data[0]=true;
	for(int i=0;i<n;i++){
		cin>>a;
		for(int i=0;i<(1<<14);i++){
			if(data[i])	data[i^a]=true;
		}
	}
	int ans=0;
	for(int i=0;i<(1<<14);i++){
		if(data[i])	ans++;
	}
	cout<<ans<<endl;
	return 0;
}
            
            
            
        
            
fiord