結果

問題 No.184 たのしい排他的論理和(HARD)
ユーザー Lepton_sLepton_s
提出日時 2015-04-17 08:56:56
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 923 bytes
コンパイル時間 694 ms
コンパイル使用メモリ 84,288 KB
実行使用メモリ 6,940 KB
最終ジャッジ日時 2024-07-04 11:23:02
合計ジャッジ時間 2,944 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:34:45: warning: format ‘%ld’ expects argument of type ‘long int*’, but argument 2 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=]
   34 |         for(int i = 0; i < n; i++) scanf("%ld", d+i);
      |                                           ~~^   ~~~
      |                                             |    |
      |                                             |    ll* {aka long long int*}
      |                                             long int*
      |                                           %lld
main.cpp:33:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   33 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~
main.cpp:34:41: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |         for(int i = 0; i < n; i++) scanf("%ld", d+i);
      |                                    ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;

#define N 100000
ll d[N];

int main(){
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%ld", d+i);
	int cnt = 0;
	for(int i = 0; i < 60; i++){
		ll b = 1LL<<i;
		int k;
		for(k = cnt; k < n; k++) if(d[k]&b) break;
		if(k==n) continue;
		swap(d[cnt], d[k]);
		k = cnt++;
		for(int j = cnt; j < n; j++){
			if(d[j]&b) d[j] ^= d[k];
		}
	}
	cout<<(1LL<<cnt)<<endl;
	return 0;
}
0