結果

問題 No.1674 Introduction to XOR
ユーザー Anshumann GargAnshumann Garg
提出日時 2022-01-18 18:25:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 1,561 ms
コンパイル使用メモリ 163,712 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-15 07:32:25
合計ジャッジ時間 2,610 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
次のファイルから読み込み:  /usr/local/gcc7/include/c++/12.2.0/istream:39,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/sstream:38,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/complex:45,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/ccomplex:39,
         次から読み込み:  /usr/local/gcc7/include/c++/12.2.0/x86_64-pc-linux-gnu/bits/stdc++.h:54,
         次から読み込み:  main.cpp:1:
メンバ関数 ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’ 内,
    inlined from ‘int32_t main()’ at main.cpp:35:13:
/usr/local/gcc7/include/c++/12.2.0/ostream:202:25: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
  202 |       { return _M_insert(__n); }
      |                ~~~~~~~~~^~~~~
main.cpp: 関数 ‘int32_t main()’ 内:
main.cpp:20:9: 備考: ‘ans’ はここで定義されています
   20 |     int ans;
      |         ^~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define oo (int)(1e17)

int32_t main() {
    cin.sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("out1.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    int a[n + 3];
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int ans;
    for (int i = 0; i <= 63; i++) {
        int curr = (1ll << i);
        int ch = 0;
        for (int j = 1; j <= n; j++) {
            if ((curr ^ a[j]) != (curr + a[j])) {
                ch = 1;
                break;
            }
        }
        if (ch == 0) {
            ans = curr;
            break;
        }
    }
    cout << ans;
}
0