QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#470709 | #1086. Bank Security Unification | ccyx505 | WA | 1ms | 5992kb | C++14 | 458b | 2024-07-10 16:00:28 | 2024-07-10 16:00:28 |
Judging History
answer
#include <iostream>
using namespace std;
const int N = 1e6 + 100;
long long a[N], n, lst[60], f[N];
int main() {
scanf ("%lld", &n);
for (int i = 1; i <= n; i++) scanf ("%lld", a + i);
for (int i = 1; i <= n; i++) {
f[i] = f[i - 1] + a[i - 1] & a[i];
for (int j = 0; j < 60; j++) f[i] = max(f[i], f[lst[j]] + a[lst[j]] & a[i]);
long long t = a[i], s = 0;
while (t) t >>= 1, s++;
lst[s] = i;
}
printf("%lld", f[n]);
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5992kb
input:
5 1 2 3 1 3
output:
2
result:
wrong answer expected '5', found '2'