結果

問題 No.3249 AND
ユーザー kotatsugame
提出日時 2025-08-30 00:56:13
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 325 bytes
コンパイル時間 657 ms
コンパイル使用メモリ 66,880 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-30 00:56:16
合計ジャッジ時間 2,468 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 20 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<cassert>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int N;cin>>N;
	vector<int>B(N);
	int X=0;
	for(int i=0;i<N;i++)
	{
		cin>>B[i];
		X|=B[i];
	}
	for(int i=0;i<N;i++)if((i+1&X)!=B[i])
	{
		cout<<-1<<endl;
		return 0;
	}
	cout<<X<<endl;
}
0