結果

問題 No.183 たのしい排他的論理和(EASY)
ユーザー syake_ta
提出日時 2018-08-26 18:34:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 1,152 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 86,436 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-01 03:58:01
合計ジャッジ時間 4,296 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:62:25: warning: iteration 5010 invokes undefined behavior [-Waggressive-loop-optimizations]
   62 |                 if (dp[i]) {
      |                     ~~~~^
main.cpp:24:37: note: within this loop
   24 | #define rep(i, m) for (int i = 0; i < m; i++)
      |                                     ^
main.cpp:61:9: note: in expansion of macro ‘rep’
   61 |         rep(i, 1 << 15) {
      |         ^~~
main.cpp:54:33: warning: iteration 5010 invokes undefined behavior [-Waggressive-loop-optimizations]
   54 |                         if (dp[j]) {
      |                             ~~~~^
main.cpp:24:37: note: within this loop
   24 | #define rep(i, m) for (int i = 0; i < m; i++)
      |                                     ^
main.cpp:53:17: note: in expansion of macro ‘rep’
   53 |                 rep(j, 1 << 15) {
      |                 ^~~

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<vector>
#include<functional>
#include<iomanip>
#include<queue>
#include<cassert>
#include<tuple>
#include<set>
#include<map>
#include<list>
#include<bitset>
#include<utility>
#include<numeric>

#define PB push_back
#define all(a)  (a).begin(),(a).end()
#define ALL(v) begin(v), end(v)
#define DWN(a)  (a).begin(),(a).end(), greater<int>()
#define rep(i, m) for (int i = 0; i < m; i++)
#define REP(i, n, m) for (int i = n; i < m; i++)
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
const int inf = (int)1e9;
const ll INF = (ll)1e18;
const ll MOD{ (ll)1e9 + 7 };
const long double EPS = 1e-10;

bool dp[5010] = {};

int main() {
	int n;
	cin >> n;

	dp[0] = true;

	rep(i, n) {
		int tmp;
		cin >> tmp;
		rep(j, 1 << 15) {
			if (dp[j]) {
				dp[tmp ^ j] = true;
			}
		}
	}

	int cnt = 0;
	rep(i, 1 << 15) {
		if (dp[i]) {
			cnt++;
		}
	}

	cout << cnt << endl;
	return 0;
}
0