結果
| 問題 | No.183 たのしい排他的論理和(EASY) |
| コンテスト | |
| ユーザー |
n_vip
|
| 提出日時 | 2015-04-17 09:43:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 5,181 bytes |
| コンパイル時間 | 811 ms |
| コンパイル使用メモリ | 101,852 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2024-07-04 15:22:51 |
| 合計ジャッジ時間 | 1,767 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 4 WA * 14 |
ソースコード
#include <string>
#include <vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<functional>
#include<list>
#include<deque>
#include<bitset>
#include<set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<sstream>
#include<complex>
#include<iomanip>
#include<numeric>
#define X first
#define Y second
#define pb push_back
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y-1);(X) >=0;--(X))
#define repe(X,Y) for ((X) = 0;(X) < (Y);++(X))
#define peat(X,Y) for (;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template<class T> using vv=vector<vector<T>>;
template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {
os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
ll MOD=2;
ll modpow(ll r,ll n,ll m=MOD){
n=(n%(m-1)+m-1)%(m-1);
if(n==0)return 1ll;
ll tmp=modpow(r,n/2,m);
return tmp*tmp%m*(n%2?r:1ll)%m;
}
double EPS=1e-12;
struct modInt{
ll v,mod;
modInt(ll v=0,ll mod=MOD):v(v),mod(mod){}
modInt operator+(const int &n){return (v+n%mod)%mod;};
modInt operator-(const int &n){return (v+mod-n%mod)%mod;};
modInt operator*(const int &n){return v*(n%mod)%mod;};
modInt operator/(const int &n){return v*modpow(n%mod,-1,mod)%mod;};
modInt &operator+=(const modInt &n){(v+=n.v%mod)%=mod;return *this;};
modInt &operator-=(const modInt &n){(v+=mod-n.v%mod)%=mod;return *this;};
modInt &operator*=(const modInt &n){(v*=n.v%mod)%=mod;return *this;};
modInt &operator/=(const modInt &n){(v*=modpow(n.v,-1,mod))%=mod;return *this;};
modInt &operator+=(const int &n){(v+=n%mod)%=mod;return *this;};
modInt &operator-=(const int &n){(v+=mod-n%mod)%=mod;return *this;};
modInt &operator*=(const int &n){(v*=n%mod)%=mod;return *this;};
modInt &operator/=(const int &n){(v*=modpow(n,-1,mod))%=mod;return *this;};
};
modInt operator-(const modInt &n){return (n.mod-n.v)%n.mod;}
modInt operator++(const modInt &n){return (n.v+1)%n.mod;}
modInt operator--(const modInt &n){return (n.v+n.mod-1)%n.mod;}
modInt operator+(const modInt &n,const modInt &m){return (n.v+m.v)%n.mod;};
modInt operator-(const modInt &n,const modInt &m){return n+(-m);};
//modInt operator*(const modInt &n){return v*n.v%mod;};
modInt operator*(const modInt &n,modInt m){return n.v*m.v%n.mod;};
modInt operator/(const modInt &n,modInt &m){return n.v*modpow(m.v%n.mod,-1,n.mod)%n.mod;};
/*modInt operator+(const int &n,modInt m){return m+n;};
modInt operator-(const int &n,modInt m){return -(m-n);};
modInt operator*(const int &n,modInt m){return m*n;};
modInt operator/(const int &n,const modInt &m){return n*modpow(m.v,-1,m.mod)%m.mod;};*/
ostream& operator<<(ostream &os,const modInt &n){return os<<n.v;};
typedef vector<vector<ll> > matl;
typedef vector<vector<double> > matd;
template<class T> vector<T> operator*(const T &a,vector<T> v){
rep(i,v.size()) v[i]=v[i]*a;
return v;
}
template<class T> vector<T> operator+(vector<T> v,const vector<T> &w){
rep(i,v.size()) v[i]=v[i]+w[i];
return v;
}
template<class T> vv<T> matE(T n){
vv<T> re(n,vector<T>(n));
rep(i,n) re[i][i]=1;
return re;
}
template<class T> vv<T>matE(const vv<T> &mat){
vv<T> re(mat.size(),vector<T>(mat.size()));
rep(i,mat.size()) re[i][i]=1;
return re;
}
template<class T> vv<T> transpose(const vv<T> &a,vector<vector<T>> &re){
re.resize(a[0].size(),vector<T>(a.size()));
rep(i,a[0].size()) rep(j,a.size()) re[i][j]=a[j][i];
return re;
}
template<class T> T operator*(const vector<T> &a,const vector<T> &b){
T re(0);
rep(i,a.size())re+=a[i]*b[i];
return re;
}
template<class T> vv<T> operator*(const vv<T> &a,const vv<T> &b_){
vv<T> b,re(a.size(),vector<T>(b_[0].size()));
transpose(b_,b);
rep(i,a.size()) rep(j,b[0].size()) re[i][j]=a[i]*b[j];
return re;
}
template<class T> vv<T> pow(vv<T> a,ll n){
if(n==0)return matE(a);
if(n%2) return a*pow(a,n-1);
vv<T> re;
re=pow(a,n/2);
return re*re;
}
bool hasInv(modInt n){return n.v!=0;};
bool hasInv(double n){return abs(n)>EPS;}
template<class T> int gyohen(vv<T> &a){
ll i,j,k,n=a.size(),agcd,m=a[0].size(),nul=0;
T div(1);
rep(i,min(n,m)){
int non0=-1;
for(j=i-nul;j<n;++j) if(hasInv(a[j][i])){non0=j; break;}
if(non0<0){ ++nul; continue;}
a[non0]=(1/a[non0][i])*a[non0];
div/=a[non0][i];
if(non0!=i-nul){swap(a[non0],a[i-nul]); div*=-1;}
rep(j,n){
if(j==i-nul)continue;
if(hasInv(a[j][i])){
// if(a[j][i]<0){a[j]=-a[j]; div*=-1;}
a[j]=a[j]+(-a[j][i]*a[i-nul]);
}
}
}
return n-nul;
}
int main(){
ios_base::sync_with_stdio(false);
cout<<fixed<<setprecision(0);
int i,j,k;
int n;
cin>>n;
vector<ll> v(n);
rep(i,n)
cin>>v[i];
vv<modInt> a(n,vector<modInt>(60,modInt(0)));
rep(i,60)rep(j,n)
if(v[j]>>i&1)
a[j][i]=1;
int d=gyohen(a);
cout<<(1ll<<d)<<endl;
return 0;
}
n_vip