結果
| 問題 |
No.2061 XOR Sort
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-26 22:29:51 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 610 bytes |
| コンパイル時間 | 3,013 ms |
| コンパイル使用メモリ | 252,716 KB |
| 実行使用メモリ | 12,032 KB |
| 最終ジャッジ日時 | 2024-10-13 23:07:46 |
| 合計ジャッジ時間 | 5,995 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 2 WA * 39 |
ソースコード
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
long long rep(int tg,vector<int> a){
if(a.size()<=1){return 1;}
vector<int> a0,a1;
for(auto &nx : a){
if(nx&(1ll<<tg)){
a1.push_back(nx);
}
else{
a0.push_back(nx);
}
}
long long res=(rep(tg-1,a0)*rep(tg-1,a1))%mod;
if(!a0.empty() && !a1.empty()){
res*=2;
res%=mod;
}
return res;
}
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());
cout << rep(29,a) << "\n";
return 0;
}