結果
| 問題 |
No.2061 XOR Sort
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-26 22:34:53 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 167 ms / 2,000 ms |
| コード長 | 664 bytes |
| コンパイル時間 | 3,456 ms |
| コンパイル使用メモリ | 253,188 KB |
| 実行使用メモリ | 11,904 KB |
| 最終ジャッジ日時 | 2024-10-13 23:13:11 |
| 合計ジャッジ時間 | 6,075 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#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;
}