QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#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;
}
Details
Tip: Click on the bar to expand more detailed information
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'