結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー Hoi_koroHoi_koro
提出日時 2016-11-24 17:12:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 396 ms / 5,000 ms
コード長 1,596 bytes
コンパイル時間 984 ms
コンパイル使用メモリ 106,796 KB
実行使用メモリ 51,636 KB
最終ジャッジ日時 2023-09-17 17:36:04
合計ジャッジ時間 9,046 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 279 ms
37,700 KB
testcase_09 AC 56 ms
10,108 KB
testcase_10 AC 213 ms
29,460 KB
testcase_11 AC 148 ms
21,796 KB
testcase_12 AC 321 ms
43,176 KB
testcase_13 AC 361 ms
46,328 KB
testcase_14 AC 196 ms
27,780 KB
testcase_15 AC 385 ms
50,108 KB
testcase_16 AC 315 ms
42,040 KB
testcase_17 AC 344 ms
45,256 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 101 ms
51,588 KB
testcase_21 AC 395 ms
51,628 KB
testcase_22 AC 396 ms
51,636 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 234 ms
32,324 KB
testcase_29 AC 340 ms
44,480 KB
testcase_30 AC 292 ms
39,416 KB
testcase_31 AC 250 ms
34,708 KB
testcase_32 AC 316 ms
42,364 KB
testcase_33 AC 377 ms
50,340 KB
testcase_34 AC 378 ms
49,700 KB
testcase_35 AC 389 ms
51,080 KB
testcase_36 AC 391 ms
50,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;
double eps=1e-8;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    LL a;
    const int dig=61;
    vector<vector<double>> t(dig,(vector<double>(n)));
    REP(i,n){
        cin >> a;
        REP(j,dig){
            t[j][i]=(a>>j)&1;
        }
    }
    int ans=0;
    REP(i,n){
        int p=ans;
        while(abs(t[p][i])<eps){
            p++;
            if(p==dig) break;
        }
        if(p==dig) continue;
        t[ans].swap(t[p]);
        FOR(j,ans+1,dig){
            FOR(k,i+1,n){
                t[j][k]-=t[ans][k]*t[j][i]/t[ans][i];
            }
        }
        ans++;
        if(ans==min(n,dig))break;
    }
    cout << (1ll<<ans)<<endl;
    return 0;
}
0