結果
問題 |
No.184 たのしい排他的論理和(HARD)
|
ユーザー |
![]() |
提出日時 | 2019-10-15 20:12:26 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 799 bytes |
コンパイル時間 | 1,234 ms |
コンパイル使用メモリ | 160,156 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-04 12:32:21 |
合計ジャッジ時間 | 3,247 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 24 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:13:23: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type*’ {aka ‘long long int*’} [-Wformat=] 13 | REP(i, n) scanf("%d", &a[i]); | ~^ | | | int* | %lld main.cpp:13:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | REP(i, n) scanf("%d", &a[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include "bits/stdc++.h" #define REP(i, n) for(int i = 0; i < int(n); i++) #define FOR(i,n,m) for(int i = int(n); i < int(m); i++) using namespace std; typedef long long ll; const int MOD = 1e9 + 7; const int INF = 1e9 + 6; const ll LLINF = 1e18 + 1; int main() { int n; cin >> n; vector<ll> a(n); REP(i, n) scanf("%d", &a[i]); int cnt = 0; REP(i, n) { // 最大でも60回程度しかならないからO(NM) if (a[i] == 0) { continue; } cnt++; int x = 0; while ((1LL << (x+1)) <= a[i]) x++; //cout << i << " " << x << " " << cnt << endl; FOR(j, i+1, n) { if ((1LL << x) & a[j]) { a[j] ^= a[i]; } } } cout << (1LL << cnt) << endl; return 0; }