QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#730522#1086. Bank Security UnificationtsongyuanmqTL 1ms5752kbC++14749b2024-11-09 20:34:362024-11-09 20:34:37

Judging History

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

  • [2024-11-09 20:34:37]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:5752kb
  • [2024-11-09 20:34:36]
  • 提交

answer

#include<iostream>
#define int long long
#define maxn 1000010
using namespace std;
namespace IO{
	int read()
	{
		int x=0,f=1;char ch=getchar();
		while(ch<'0'||ch>'9')
		{
			if(ch=='-')f=-1;
			ch=getchar();
		}
		while(ch>='0'&&ch<='9')
		{
			x=x*10+ch-'0';
			ch=getchar();
		}return x*f;
	}
	void print(int x)
	{
		if(x<0)
		{
			putchar('-');
			x=-x;
		}
		if(x>9)print(x/10);
		putchar(x%10+'0');
	}
}using namespace IO;
int n,a[maxn],f[maxn];
signed main()
{
//	freopen("rose4.in","r",stdin);
//	freopen("rose.out","w",stdout);
	n=read();
	for(int i=1;i<=n;i++)a[i]=read();
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<i;j++)
		{
			f[i]=max(f[i],f[j]+(a[i]&a[j]));
		}
	}print(f[n]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 2 3 1 3

output:

5

result:

ok answer is '5'

Test #2:

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

input:

4
1 2 4 0

output:

0

result:

ok answer is '0'

Test #3:

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

input:

2
1000000000000 1000000000000

output:

1000000000000

result:

ok answer is '1000000000000'

Test #4:

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

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: 5684kb

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: 5608kb

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: -100
Time Limit Exceeded

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:


result: