QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#188453 | #1086. Bank Security Unification | As3b_team_f_masr# | WA | 1ms | 5640kb | C++14 | 834b | 2023-09-25 20:49:26 | 2023-09-25 20:49:27 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, 0, 0, 1, -1, 1};
int dj[] = {0, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18;
const int N = 2e6 + 5, M = 1e4 + 5, MOD = 998244353;
#define EPS 1e-9
ll n, m, a[N], dp[N], lst[N], mx;
int main() {
//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
//memset(dp, -1, sizeof dp);
cin >> n;
for(int i=1;i <= n;i++){
cin >> a[i];
for(int j = 0; j < 40 ;++j){
if(a[i] & (1 << j))
dp[i] = max(dp[i] , dp[lst[j]] + (a[lst[j]] & a[i])),
mx = max(mx, dp[i]);
}
for(int j = 0; j < 40 ;++j) {
if (a[i] & (1 << j))
lst[j] = i;
}
}
cout << mx;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 5640kb
input:
5 1 2 3 1 3
output:
5
result:
ok answer is '5'
Test #2:
score: 0
Accepted
time: 1ms
memory: 5584kb
input:
4 1 2 4 0
output:
0
result:
ok answer is '0'
Test #3:
score: 0
Accepted
time: 0ms
memory: 5464kb
input:
2 1000000000000 1000000000000
output:
1000000000000
result:
ok answer is '1000000000000'
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 5596kb
input:
100 42357619991 34637578715 14383875856 65298594968 204835436802 17842451301 27263566591 56672847581 9938910048 37783918480 178688553850 31652616803 34569713543 278151742734 458183081930 36307485267 52046737444 29733829337 156411959819 70476873663 322768771475 306850928242 68922415915 108092954267 1...
output:
3693654723048
result:
wrong answer expected '4105724254392', found '3693654723048'