結果
| 問題 |
No.184 たのしい排他的論理和(HARD)
|
| コンテスト | |
| ユーザー |
y_mazun
|
| 提出日時 | 2015-04-17 00:06:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 707 bytes |
| コンパイル時間 | 1,989 ms |
| コンパイル使用メモリ | 41,728 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-04 11:12:50 |
| 合計ジャッジ時間 | 2,997 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 5 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
24 | REP(i,n) scanf("%lld", &a[i]);
| ~~~~~^~~~~~~~~~~~~~~
main.cpp: In function ‘int getInt()’:
main.cpp:7:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | inline int getInt(){ int s; scanf("%d", &s); return s; }
| ~~~~~^~~~~~~~~~
ソースコード
#include <queue>
typedef long long ll;
#define REP(i,n) for(int i=0; i<(int)(n); i++)
#include <cstdio>
inline int getInt(){ int s; scanf("%d", &s); return s; }
#include <set>
using namespace std;
/*
y1 = x00 * x0 + x10 * x1 + ... + xn0 * xn
y2 = x01 * x0 + x11 * x1 + ... + xn1 * xn
...
yk = x0k * x0 + x1k * x1 + ... + xnk * xn
*/
int main(){
const int n = getInt();
vector<ll> a(n);
REP(i,n) scanf("%lld", &a[i]);
ll ans = 1;
REP(i,62){
int p = 0;
for(; p < n; p++)
if(a[p] & (1ll << i))
break;
if(p == n) continue;
ans *= 2;
REP(j,n) if(a[j] & (1ll << i)){
a[j] = (a[j] ^ a[p]) | (1ll << i);
}
}
printf("%lld\n", ans);
return 0;
}
y_mazun