QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#471155 | #1086. Bank Security Unification | BartAllen | WA | 1ms | 5992kb | C++14 | 423b | 2024-07-10 18:44:22 | 2024-07-10 18:44:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 5;
int n;
ll a[N], dp[N], lst[65];
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
for (int j = 0; j < 60; j++) dp[i] = max(dp[i], dp[lst[j]] + (a[i] & a[lst[j]]));
int s = 0;
ll t = a[i];
while (t) t >>= 1, s++;
lst[s] = i;
}
printf("%d", dp[n]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5992kb
input:
5 1 2 3 1 3
output:
5
result:
ok answer is '5'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5880kb
input:
4 1 2 4 0
output:
0
result:
ok answer is '0'
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 5836kb
input:
2 1000000000000 1000000000000
output:
-727379968
result:
wrong answer expected '1000000000000', found '-727379968'