結果
問題 |
No.184 たのしい排他的論理和(HARD)
|
ユーザー |
![]() |
提出日時 | 2015-04-17 06:53:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 99 ms / 5,000 ms |
コード長 | 683 bytes |
コンパイル時間 | 532 ms |
コンパイル使用メモリ | 75,112 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-04 11:20:41 |
合計ジャッジ時間 | 3,429 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; int main(){ int n; cin >> n; vector<long long> a(n); for(int i=0; i<n; i++){ cin >> a[i]; } int rank = 0; long long row = 0; for(int col=0; col<64; col++){ int pivot = row; while( pivot < n && ((a[pivot] >> col) & 1) == false ) pivot++; if( pivot >= n || ((a[pivot] >> col) & 1) == false ) continue; swap(a[row], a[pivot]); for(int i=row+1; i<n; i++){ if(a[i] >> col & 1) a[i] ^= a[row]; } row++; rank++; } cout << (1LL<<rank) << endl; return 0; }