QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#35500#1086. Bank Security UnificationFroggyguaWA 3ms5692kbC++17400b2022-06-16 14:48:492022-06-16 14:48:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-16 14:48:51]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5692kb
  • [2022-06-16 14:48:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define N 1000020
typedef long long ll;
int n,las[55];
ll a[N],dp[N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
	}
	for(int i=1;i<=n;++i){
		for(int j=0;j<50;++j){
			dp[i]=max(dp[i],dp[las[j]]+(a[las[j]]&a[i]));
			if(i>>j&1)las[j]=i;
		}
	}
	cout<<dp[n]<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 5544kb

input:

5
1 2 3 1 3

output:

5

result:

ok answer is '5'

Test #2:

score: 0
Accepted
time: 2ms
memory: 5616kb

input:

4
1 2 4 0

output:

0

result:

ok answer is '0'

Test #3:

score: 0
Accepted
time: 2ms
memory: 5692kb

input:

2
1000000000000 1000000000000

output:

1000000000000

result:

ok answer is '1000000000000'

Test #4:

score: -100
Wrong Answer
time: 3ms
memory: 5632kb

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:

3075905339745

result:

wrong answer expected '4105724254392', found '3075905339745'