結果
| 問題 |
No.2061 XOR Sort
|
| コンテスト | |
| ユーザー |
たたき@競プロ
|
| 提出日時 | 2023-08-04 21:10:11 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 230 ms / 2,000 ms |
| コード長 | 921 bytes |
| コンパイル時間 | 5,710 ms |
| コンパイル使用メモリ | 312,172 KB |
| 実行使用メモリ | 16,620 KB |
| 最終ジャッジ日時 | 2024-10-14 18:54:48 |
| 合計ジャッジ時間 | 8,239 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 41 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
int n;cin>>n;
set<int>s;
rep(i,n){
int a;cin>>a;
s.insert(a);
}
vc<int>v;
for(auto au:s)v.pb(au);
int t=30;
vc<bool>bo(t,false);
auto f=[&](auto f,int a,vc<int>x)->void{
if(a==-1)return;
vc<int>z,o;
for(auto au:x){
if(au>>a&1)o.pb(au);
else z.pb(au);
}
if(o.size()&&z.size())bo[a]=true;
if((int)z.size()>1)f(f,a-1,z);
if((int)o.size()>1)f(f,a-1,o);
return;
};
f(f,t-1,v);
int k=0; rep(i,t)if(bo[i])k++;
mint ans=mint(2).pow(k);
cout<<ans.val();
}
たたき@競プロ