結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2018-09-15 12:50:12 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 985 ms / 5,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 23,680 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 04:37:18 |
合計ジャッジ時間 | 8,025 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:15:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d", &arr[i]); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <limits.h> int main() { const int inf = -INT_MAX; int n; int arr[5010] = {}; int f[100000] = {}; scanf("%d", &n); int i, j; for (i = 0; i < n; i++) { scanf("%d", &arr[i]); } for (i = 0; i < 100000; i++) { f[i] = inf; } f[0] = 0; for (i = 0; i < n; i++) { int tmp[100000] = {}; for (j = 0; j < 100000; j++) { if (f[j] >= 0) tmp[j^arr[i]] = 10; } for (j = 0; j < 100000; j++) { if (tmp[j] > 0) f[j] = 1; } } int result = 0; for (i = 0; i < 100000; i++) { if (f[i] >= 0) result++; } printf("%d", result); getchar(); getchar(); return 0; }