結果

問題 No.2061 XOR Sort
ユーザー butsurizukibutsurizuki
提出日時 2022-08-26 22:34:53
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 664 bytes
コンパイル時間 4,244 ms
コンパイル使用メモリ 253,000 KB
実行使用メモリ 11,512 KB
最終ジャッジ日時 2023-08-04 02:07:59
合計ジャッジ時間 6,184 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,504 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 75 ms
5,068 KB
testcase_15 AC 73 ms
4,892 KB
testcase_16 AC 150 ms
7,184 KB
testcase_17 AC 96 ms
5,356 KB
testcase_18 AC 97 ms
5,892 KB
testcase_19 AC 95 ms
5,408 KB
testcase_20 AC 15 ms
4,380 KB
testcase_21 AC 42 ms
4,376 KB
testcase_22 AC 75 ms
4,992 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 154 ms
6,984 KB
testcase_25 AC 154 ms
7,444 KB
testcase_26 AC 154 ms
7,064 KB
testcase_27 AC 156 ms
7,096 KB
testcase_28 AC 155 ms
7,076 KB
testcase_29 AC 44 ms
11,512 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 6 ms
4,648 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,384 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define mod 998244353

using namespace std;

vector<int> fl(32,0);
void rep(int tg,vector<int> a){
  if(a.size()<=1){return;}

  vector<int> a0,a1;
  for(auto &nx : a){
    if(nx&(1ll<<tg)){
      a1.push_back(nx);
    }
    else{
      a0.push_back(nx);
    }
  }

  if(!a0.empty() && !a1.empty()){
    fl[tg]=1;
  }
  rep(tg-1,a0);
  rep(tg-1,a1);
}

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(auto &nx : a){cin >> nx;}
  sort(a.begin(),a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  rep(29,a);
  long long res=1;
  for(auto &nx : fl){
    if(nx==1){res*=2;res%=mod;}
  }
  cout << res << "\n";
  return 0;
}
0