結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー Shun TakaseShun Takase
提出日時 2020-06-14 06:50:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 99 ms / 5,000 ms
コード長 1,798 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 166,672 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-17 18:20:20
合計ジャッジ時間 4,779 ms
ジャッジサーバーID
(参考情報)
judge12 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 71 ms
4,376 KB
testcase_09 AC 16 ms
4,376 KB
testcase_10 AC 54 ms
4,376 KB
testcase_11 AC 40 ms
4,376 KB
testcase_12 AC 82 ms
4,376 KB
testcase_13 AC 88 ms
4,376 KB
testcase_14 AC 51 ms
4,380 KB
testcase_15 AC 96 ms
4,376 KB
testcase_16 AC 80 ms
4,376 KB
testcase_17 AC 86 ms
4,376 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 16 ms
4,376 KB
testcase_21 AC 99 ms
4,380 KB
testcase_22 AC 98 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 59 ms
4,376 KB
testcase_29 AC 84 ms
4,376 KB
testcase_30 AC 73 ms
4,380 KB
testcase_31 AC 63 ms
4,376 KB
testcase_32 AC 78 ms
4,376 KB
testcase_33 AC 96 ms
4,376 KB
testcase_34 AC 95 ms
4,380 KB
testcase_35 AC 97 ms
4,376 KB
testcase_36 AC 98 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> void pr_vec(vector<T> &v, char ep=' '){int n=v.size();REP(ni,n){cout<<v[ni];if(ni!=n-1)cout<<ep;}cout<<endl;};
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int gauss_jordan(vector<ll>& mat){
    int n = mat.size();
    int ret = 0;
	REP(i,n) if(mat[i]) {
		ret++;
		int x=0;
		while((1LL<<(x+1))<=mat[i]) x++;
		for(int y = i+1; y<n; y++) if(mat[y] & (1LL<<x)) mat[y] ^= mat[i];
	}
    return ret;
}

int main(void)
{
    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    pr(1LL<<gauss_jordan(A));
}
0