結果
問題 | No.183 たのしい排他的論理和(EASY) |
ユーザー |
![]() |
提出日時 | 2015-04-16 23:44:57 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 5 ms / 5,000 ms |
コード長 | 948 bytes |
コンパイル時間 | 656 ms |
コンパイル使用メモリ | 85,768 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-29 01:43:03 |
合計ジャッジ時間 | 1,377 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
コンパイルメッセージ
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); | ~~~~~^~~~~~~~~~~~
ソースコード
#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 100000ll 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++){sort(d+cnt, d+n);ll b = 1LL<<i;int k;for(k = cnt; k < n; k++) if(d[k]&b) break;if(!(d[k]&b)) 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;}