結果

問題 No.2061 XOR Sort
ユーザー otoshigootoshigo
提出日時 2022-08-27 12:53:10
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,814 ms / 2,000 ms
コード長 1,408 bytes
コンパイル時間 2,356 ms
コンパイル使用メモリ 202,256 KB
実行使用メモリ 15,248 KB
最終ジャッジ日時 2024-04-22 11:38:35
合計ジャッジ時間 19,841 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,248 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 621 ms
9,052 KB
testcase_15 AC 622 ms
8,888 KB
testcase_16 AC 1,660 ms
14,476 KB
testcase_17 AC 834 ms
10,728 KB
testcase_18 AC 855 ms
10,332 KB
testcase_19 AC 854 ms
10,132 KB
testcase_20 AC 94 ms
5,376 KB
testcase_21 AC 337 ms
6,280 KB
testcase_22 AC 616 ms
8,928 KB
testcase_23 AC 11 ms
5,376 KB
testcase_24 AC 1,814 ms
15,068 KB
testcase_25 AC 1,685 ms
14,988 KB
testcase_26 AC 1,703 ms
14,856 KB
testcase_27 AC 1,663 ms
14,816 KB
testcase_28 AC 1,662 ms
15,248 KB
testcase_29 AC 104 ms
6,884 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 12 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 2 ms
5,376 KB
testcase_36 AC 2 ms
5,376 KB
testcase_37 AC 2 ms
5,376 KB
testcase_38 AC 2 ms
5,376 KB
testcase_39 AC 2 ms
5,376 KB
testcase_40 AC 2 ms
5,376 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
using ll = long long;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,a,b) for (int i = a; i < b; i++)
#define rrep2(i,a,b) for (int i = a-1; i >= b; i--)
#define rep3(i,a,b,c) for (int i = a; i < b; i+=c)
#define rrep3(i,a,b,c) for (int i = a-1; i >= b; i-=c)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

const int MOD=998244353;

int n,A[200010];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>n;
    rep(i,n)cin>>A[i];
    ll ans=1;
    rep(i,30){
        set<int>se1,se0;
        vector<int>v;
        rep(j,n){
            v.push_back(A[j]>>(i+1));
            if(A[j]>>i&1)se1.insert(A[j]>>(i+1));
            else se0.insert(A[j]>>(i+1));
        }
        bool ok=false;
        if(se1.size()&&se0.size()){
            for(auto x:v){
                if(se1.count(x)&&se0.count(x)){
                    ok=true;
                    break;
                }
            }
        }
        if(ok){
            ans*=2;
            ans%=MOD;
        }
    }
    cout<<ans<<"\n";
}
0