結果
| 問題 | No.3249 AND | 
| コンテスト | |
| ユーザー |  risujiroh | 
| 提出日時 | 2025-08-29 21:28:34 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                WA
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 1,877 bytes | 
| コンパイル時間 | 2,597 ms | 
| コンパイル使用メモリ | 283,244 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-08-29 23:57:29 | 
| 合計ジャッジ時間 | 4,231 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 20 WA * 1 | 
ソースコード
#if __INCLUDE_LEVEL__ == 0
#include __BASE_FILE__
void Solve() {
  int n;
  IN(n);
  vector<int> a(n);
  IN(a);
  array<int, 20> s;
  s.fill(-1);
  for (int i : Rep(0, n)) {
    int i1 = i + 1;
    int ai = a[i];
    for (int k : Rep(0, 20)) {
      int aik = ai >> k & 1;
      int i1k = i1 >> k & 1;
      if (aik && i1k) {
        if (s[k] == 0) {
          OUT(-1);
          return;
        }
        s[k] = 1;
      } else if (aik) {
        OUT(-1);
        return;
      } else if (i1k) {
        if (s[k] == 1) {
          OUT(-1);
          return;
        }
        s[k] = 0;
      } else {
      }
    }
  }
  int ans = 0;
  for (int k : Rep(0, 20)) {
    if (s[k] == 1) {
      ans |= 1 << k;
    }
  }
  OUT(ans);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  Solve();
}
#elif __INCLUDE_LEVEL__ == 1
#include <bits/stdc++.h>
template <class T> concept MyRange = std::ranges::range<T> && !std::convertible_to<T, std::string_view>;
template <class T> concept MyTuple = std::__is_tuple_like<T>::value && !MyRange<T>;
namespace std {
istream& operator>>(istream& is, MyRange auto&& r) {
  for (auto&& e : r) is >> e;
  return is;
}
istream& operator>>(istream& is, MyTuple auto&& t) {
  apply([&](auto&... xs) { (is >> ... >> xs); }, t);
  return is;
}
ostream& operator<<(ostream& os, MyRange auto&& r) {
  auto sep = "";
  for (auto&& e : r) os << exchange(sep, " ") << e;
  return os;
}
ostream& operator<<(ostream& os, MyTuple auto&& t) {
  auto sep = "";
  apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t);
  return os;
}
}  // namespace std
using namespace std;
#define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__)
#define IN(...) (cin >> forward_as_tuple(__VA_ARGS__))
#define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n')
#endif  // __INCLUDE_LEVEL__ == 1
            
            
            
        