結果
| 問題 |
No.183 たのしい排他的論理和(EASY)
|
| コンテスト | |
| ユーザー |
matsu7874
|
| 提出日時 | 2015-12-27 21:10:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 559 bytes |
| コンパイル時間 | 1,258 ms |
| コンパイル使用メモリ | 159,060 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 07:31:11 |
| 合計ジャッジ時間 | 1,916 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 9 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:15:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d", &A[i]);
| ~~~~~^~~~~~~~~~~~~
ソースコード
// g++ -std=c++0x -O2
#include <bits/stdc++.h>
using namespace std;
#define MAX_V 32768
int main() {
int N;
int A[5000];
int i, j;
bool dp[MAX_V];
scanf("%d", &N);
for (i = 0; i < N; ++i) {
scanf("%d", &A[i]);
}
for (i = 1; i < MAX_V; ++i) {
dp[i] = false;
}
dp[0] = true;
for (i = 0; i < N; ++i) {
for (j = 0; j < N; ++j) {
if (dp[j]) {
dp[j ^ A[i]] = true;
}
}
}
int cnt = 0;
for (i = 0; i < MAX_V; ++i) {
if (dp[i]) {
cnt += 1;
}
}
printf("%d\n", cnt);
return 0;
}
matsu7874