結果
問題 |
No.2071 Shift and OR
|
ユーザー |
|
提出日時 | 2022-09-16 22:15:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 615 bytes |
コンパイル時間 | 2,035 ms |
コンパイル使用メモリ | 200,140 KB |
最終ジャッジ日時 | 2025-02-07 09:52:42 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; const ll mod = 998244353; const ll INF = (1LL << 60); int shift(int x) { return (x / 2) + (1 << 15) * (x % 2); } int main() { int N; cin >> N; vector<int> A(N); for(int i = 0; i < N; i++) cin >> A[i]; sort(A.rbegin(), A.rend()); int ans = 0; for(int i = 0; i < N; i++) { int rev = ans; for(int cnt = 0; cnt <= 16; cnt++) { rev = max(rev, (ans | A[i])); A[i] = shift(A[i]); } ans = rev; } cout << ans << endl; return 0; }