結果
| 問題 | No.3550 Another Rurumaru Function Problem |
| コンテスト | |
| ユーザー |
沙耶花
|
| 提出日時 | 2026-05-22 23:15:47 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 825 bytes |
| 記録 | |
| コンパイル時間 | 4,219 ms |
| コンパイル使用メモリ | 274,448 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-05-22 23:15:56 |
| 合計ジャッジ時間 | 6,494 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 |
ソースコード
#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001LL
int main(){
int n;
cin>>n;
vector<int> a(n);
rep(i,n){
cin>>a[i];
}
int ans = 0;
int mask = 0;
for(int i=29;i>=0;i--){
if(i%2==1){
bool f = false;
rep(j,a.size()){
if((a[j]>>i)&1){
f = true;
}
}
if(f){
mask |= 1<<i;
ans += 1<<i;
}
}
else{
vector<int> b;
rep(j,a.size()){
if((a[j]>>i)&1){
b.push_back(a[j]);
}
}
if(b.size()==0)continue;
int cur = 0;
rep(j,b.size()){
cur |= b[j];
}
if((mask & cur)!=mask)continue;
ans += 1<<i;
a = b;
}
}
cout<<ans<<endl;
return 0;
}
沙耶花