結果
| 問題 |
No.184 たのしい排他的論理和(HARD)
|
| コンテスト | |
| ユーザー |
tottoripaper
|
| 提出日時 | 2015-05-23 19:04:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 51 ms / 5,000 ms |
| コード長 | 621 bytes |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 34,292 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 11:52:42 |
| 合計ジャッジ時間 | 2,612 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d", &N);
| ~~~~~^~~~~~~~~~
main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%lld", A+i);
| ~~~~~^~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <algorithm>
typedef long long ll;
int N;
ll A[100000];
int main(){
scanf("%d", &N);
for(int i=0;i<N;i++){
scanf("%lld", A+i);
}
int rank = 0;
for(int i=0;i<=60;i++){
{
int j = rank;
for(;j<N;j++){
if(A[j] >> i & 1){break;}
}
if(j == N){continue;}
std::swap(A[j], A[rank]);
}
for(int j=rank+1;j<N;j++){
if(!(A[j] >> i & 1)){continue;}
A[j] ^= A[rank];
}
++rank;
}
printf("%lld\n", 1ll << rank);
}
tottoripaper