QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#471155#1086. Bank Security UnificationBartAllenWA 1ms5992kbC++14423b2024-07-10 18:44:222024-07-10 18:44:22

Judging History

你现在查看的是最新测评结果

  • [2024-07-10 18:44:22]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5992kb
  • [2024-07-10 18:44:22]
  • 提交

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;
}

详细

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'