結果
| 問題 |
No.2061 XOR Sort
|
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2022-08-26 23:00:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 480 ms / 2,000 ms |
| コード長 | 792 bytes |
| コンパイル時間 | 4,185 ms |
| コンパイル使用メモリ | 253,452 KB |
| 最終ジャッジ日時 | 2025-01-31 05:29:30 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001
int main() {
int n;
cin>>n;
vector<vector<int>> a(1);
rep(i,n){
int x;
cin>>x;
a[0].push_back(x);
}
long long ans = 1;
for(int i=30;i>=0;i--){
bool f = false;
vector<vector<int>> b;
rep(j,a.size()){
vector<vector<int>> t(2,vector<int>(0));
rep(k,a[j].size()){
t[(a[j][k]>>i)&1].push_back(a[j][k]);
}
if(t[0].size()!=0&&t[1].size()!=0)f = true;
if(t[0].size()!=0)b.push_back(t[0]);
if(t[1].size()!=0)b.push_back(t[1]);
}
swap(a,b);
if(f)ans *= 2;
}
cout<<ans%998244353<<endl;
return 0;
}
沙耶花