結果
問題 |
No.3249 AND
|
ユーザー |
![]() |
提出日時 | 2025-08-29 21:29:33 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 586 bytes |
コンパイル時間 | 6,105 ms |
コンパイル使用メモリ | 332,344 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-08-29 23:57:43 |
合計ジャッジ時間 | 5,848 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 WA * 1 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> #define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++) using namespace atcoder; using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << fixed << setprecision(12); int ans = 0; int n; cin >> n; vector<int> a(n + 1); rep(i, 1, n + 1) { cin >> a[i]; ans |= (i & a[i]); } rep(i, 1, n + 1) { if ((ans & i) != a[i]) { cout << "-1" << endl; return 0; } } cout << ans << endl; }