結果
問題 |
No.183 たのしい排他的論理和(EASY)
|
ユーザー |
|
提出日時 | 2025-08-17 00:51:38 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 360 bytes |
コンパイル時間 | 646 ms |
コンパイル使用メモリ | 80,328 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-17 00:51:42 |
合計ジャッジ時間 | 3,185 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 16 WA * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:17: warning: format ‘%u’ expects argument of type ‘unsigned int*’, but argument 2 has type ‘short unsigned int*’ [-Wformat=] 11 | scanf("%u", &N); | ~^ ~~ | | | | | short unsigned int* | unsigned int* | %hu main.cpp:12:40: warning: format ‘%u’ expects argument of type ‘unsigned int*’, but argument 2 has type ‘short unsigned int*’ [-Wformat=] 12 | for(i = 0; i < N; i++) scanf("%u", &A[i]); | ~^ ~~~~~ | | | | | short unsigned int* | unsigned int* | %hu main.cpp:16:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘std::size_t’ {aka ‘long unsigned int’} [-Wformat=] 16 | printf("%d\n", dp.count()); | ~^ ~~~~~~~~~~ | | | | int std::size_t {aka long unsigned int} | %ld main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%u", &N); | ~~~~~^~~~~~~~~~ main.cpp:12:37: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | for(i = 0; i < N; i++) scanf("%u", &A[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include <iostream> #include <bitset> using namespace std; unsigned short i,j,N; unsigned short A[5000]; const unsigned short M = 32768; bitset<M> dp(1); int main(void) { scanf("%u", &N); for(i = 0; i < N; i++) scanf("%u", &A[i]); for(i = 0; i < N; i++) for(j = 0; j < M; j++) if(dp.test(j)) dp.set(j ^ A[i]); printf("%d\n", dp.count()); return 0; }