結果
| 問題 | No.184 たのしい排他的論理和(HARD) |
| コンテスト | |
| ユーザー |
Hoi_koro
|
| 提出日時 | 2016-11-24 17:12:15 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 357 ms / 5,000 ms |
| コード長 | 1,596 bytes |
| 記録 | |
| コンパイル時間 | 909 ms |
| コンパイル使用メモリ | 108,196 KB |
| 実行使用メモリ | 51,840 KB |
| 最終ジャッジ日時 | 2024-07-04 12:13:59 |
| 合計ジャッジ時間 | 8,078 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
ソースコード
#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;
}
Hoi_koro