QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#602206#1086. Bank Security UnificationLeonadorWA 140ms19528kbC++14442b2024-09-30 21:02:302024-09-30 21:02:30

Judging History

This is the latest submission verdict.

  • [2024-09-30 21:02:30]
  • Judged
  • Verdict: WA
  • Time: 140ms
  • Memory: 19528kb
  • [2024-09-30 21:02:30]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define N (int)(1e6+10)

int n,ans;
int a[N],lst[50];
int dp[N];

signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	for(int i=1;i<=n;++i){
		for(int j=0;j<40;++j){
			if((a[i]>>j)&1){
				dp[i]=max(dp[i],dp[lst[j]]+(a[lst[j]]&a[i]));
				lst[j]=i;
			}
			ans=max(ans,dp[i]);
		}
	}
	printf("%lld\n",ans);
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 6004kb

input:

5
1 2 3 1 3

output:

5

result:

ok answer is '5'

Test #2:

score: 0
Accepted
time: 1ms
memory: 6000kb

input:

4
1 2 4 0

output:

0

result:

ok answer is '0'

Test #3:

score: 0
Accepted
time: 1ms
memory: 5944kb

input:

2
1000000000000 1000000000000

output:

1000000000000

result:

ok answer is '1000000000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 5820kb

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:

4105724254392

result:

ok answer is '4105724254392'

Test #5:

score: 0
Accepted
time: 1ms
memory: 5956kb

input:

200
32491481529 22326116709 38413035282 6379551923 17186666096 710945826 99671547638 21583864468 43358433566 110817310097 58936170734 12118139703 99298292577 7807334015 283126465825 29798702686 966557737 78175604253 84922374374 66149759365 4499380469 17953982120 22738453560 35389367375 71164988711 1...

output:

4385401630265

result:

ok answer is '4385401630265'

Test #6:

score: 0
Accepted
time: 1ms
memory: 5916kb

input:

300
0 0 0 7227130 0 44665356632 741540074 3252 1053109 0 0 3343976697 299282315 7 57190829 0 4379965174 17883634737 17400873810 3693 134 144164936555 320312270 0 0 423566 549 0 1979 0 0 0 2462345997 1021629061 483112 0 172597 11 0 0 0 0 3189174969 64832 14166776345 69159 0 0 56330326146 0 1206275174...

output:

2110095119925

result:

ok answer is '2110095119925'

Test #7:

score: 0
Accepted
time: 140ms
memory: 19528kb

input:

1000000
380994485120 380994485121 380994485122 380994485123 380994485124 380994485125 380994485126 380994485127 380994485128 380994485129 380994485130 380994485131 380994485132 380994485133 380994485134 380994485135 380994485136 380994485137 380994485138 380994485139 380994485140 380994485141 380994...

output:

56209236563089050

result:

ok answer is '56209236563089050'

Test #8:

score: -100
Wrong Answer
time: 140ms
memory: 19396kb

input:

999947
694442488933 694442488934 694442488935 694442488936 694442488937 694442488938 694442488939 694442488940 694442488941 694442488942 694442488943 694442488944 694442488945 694442488946 694442488947 694442488948 694442488949 694442488950 694442488951 694442488952 694442488953 694442488954 6944424...

output:

53476040131480808

result:

wrong answer expected '53476040131480818', found '53476040131480808'