結果

問題 No.2061 XOR Sort
ユーザー 👑 Nachia
提出日時 2024-04-22 22:49:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 975 ms
コンパイル使用メモリ 85,476 KB
最終ジャッジ日時 2025-02-21 08:36:59
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <atcoder/modint>

using namespace std;
using u64 = unsigned long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using modint = atcoder::static_modint<998244353>;



int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N; cin >> N;
    vector<u64> A(N); rep(i,N) cin >> A[i];
    set<u64> S(A.begin(), A.end());
    A = vector<u64>(S.begin(), S.end());
    modint ans = 1;
    rep(d,30){
        u64 D = 1ull << d;
        for(u64 a : A){
            u64 l = (a^D)&~(D-1);
            u64 r = l+D;
            if(S.lower_bound(l) != S.lower_bound(r)){ ans *= 2; break; }
        }
    }
    cout << ans.val() << '\n';
    return 0;
}
0