結果
| 問題 | No.183 たのしい排他的論理和(EASY) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-31 11:42:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 763 bytes |
| コンパイル時間 | 476 ms |
| コンパイル使用メモリ | 62,524 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-12 01:32:27 |
| 合計ジャッジ時間 | 2,187 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:28:12: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
28 | scanf("%d", &A[i]);
| ~~~~~^~~~~~~~~~~~~
main.cpp:39:18: warning: iteration 65536 invokes undefined behavior [-Waggressive-loop-optimizations]
39 | ans += dp[i];
| ~~~~^
main.cpp:16:30: note: within this loop
16 | #define rep(i,b) for(ll i=0;i<(b);++i)
| ^
main.cpp:38:4: note: in expansion of macro ‘rep’
38 | rep(i, (1 << 16)+1) {
| ^~~
ソースコード
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <numeric>
#include <tuple>
#include <cstdio>
#include <assert.h>
using namespace std;
typedef long long ll;
#define rep(i,b) for(ll i=0;i<(b);++i)
#define rep1(i,b) for(ll i=1;i<=(b);++i)
#define vec vector
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
int N;
int A[5010];
int dp[(1 << 16)];
int main() {
cin >> N;
rep1(i, N) {
scanf("%d", &A[i]);
dp[A[i]] = 1;
}
cout << "Done" << endl;
for (int i=0;i<=N;i++) {
for (int j=(1 << 15);j>=0;j--) {
dp[j ^ A[i]] |= dp[j] & dp[A[i]];
}
}
int ans = 0;
rep(i, (1 << 16)+1) {
ans += dp[i];
}
cout << ans << endl;
}