Submission #61179573


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 2e5+5;
inline LL read()
{
LL res=0; char x=getchar();
while(x<'0'||x>'9') x=getchar();
while(x<='9'&&x>='0') res=(res<<1)+(res<<3)+(x^48),x=getchar();
return res;
}
int n,k;
LL a[N],ans,sum;
void dfs(int p,int b,LL res)
{
if(p==k+1)
{
ans=max(ans,res); return;
}
for(int i=b;i<=n;i++)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 2e5+5;
inline LL read()
{
	LL res=0; char x=getchar();
	while(x<'0'||x>'9') x=getchar();
	while(x<='9'&&x>='0') res=(res<<1)+(res<<3)+(x^48),x=getchar();
	return res;
}
int n,k;
LL a[N],ans,sum;
void dfs(int p,int b,LL res)
{
	if(p==k+1)
	{
		ans=max(ans,res); return;
	}
	for(int i=b;i<=n;i++)
	{
		dfs(p+1,i+1,res^a[i]);
	}
}
int main()
{
	// freopen("in.in","r",stdin);
	// freopen("out.out","w",stdout);
	n=read(); k=read();
	for(int i=1;i<=n;i++) a[i]=read(),sum^=a[i];
	if(k>(n>>1)) k=n-k; else sum=0;
	dfs(1,1,sum);
	printf("%lld\n",ans);
	return 0;
}

Submission Info

Submission Time
Task E - Maximize XOR
User ppllxx
Language C++ 20 (gcc 12.2)
Score 500
Code Size 672 Byte
Status AC
Exec Time 13 ms
Memory 5404 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 2
AC × 48
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 01_test_28.txt, 01_test_29.txt, 01_test_30.txt, 01_test_31.txt, 01_test_32.txt, 01_test_33.txt, 01_test_34.txt, 01_test_35.txt, 01_test_36.txt, 01_test_37.txt, 01_test_38.txt, 01_test_39.txt, 01_test_40.txt, 01_test_41.txt, 01_test_42.txt, 01_test_43.txt, 01_test_44.txt, 01_test_45.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3584 KB
00_sample_01.txt AC 1 ms 3584 KB
01_test_00.txt AC 6 ms 4296 KB
01_test_01.txt AC 13 ms 5184 KB
01_test_02.txt AC 11 ms 5020 KB
01_test_03.txt AC 12 ms 5268 KB
01_test_04.txt AC 2 ms 3788 KB
01_test_05.txt AC 3 ms 3588 KB
01_test_06.txt AC 1 ms 3580 KB
01_test_07.txt AC 3 ms 3668 KB
01_test_08.txt AC 1 ms 3780 KB
01_test_09.txt AC 3 ms 3744 KB
01_test_10.txt AC 1 ms 3776 KB
01_test_11.txt AC 3 ms 3780 KB
01_test_12.txt AC 1 ms 3772 KB
01_test_13.txt AC 4 ms 3788 KB
01_test_14.txt AC 1 ms 3708 KB
01_test_15.txt AC 3 ms 3712 KB
01_test_16.txt AC 1 ms 3712 KB
01_test_17.txt AC 3 ms 3660 KB
01_test_18.txt AC 1 ms 3784 KB
01_test_19.txt AC 3 ms 3660 KB
01_test_20.txt AC 3 ms 3656 KB
01_test_21.txt AC 3 ms 3600 KB
01_test_22.txt AC 1 ms 3640 KB
01_test_23.txt AC 4 ms 3628 KB
01_test_24.txt AC 1 ms 3848 KB
01_test_25.txt AC 4 ms 3724 KB
01_test_26.txt AC 2 ms 3644 KB
01_test_27.txt AC 4 ms 3644 KB
01_test_28.txt AC 1 ms 3772 KB
01_test_29.txt AC 4 ms 3716 KB
01_test_30.txt AC 4 ms 3780 KB
01_test_31.txt AC 4 ms 3628 KB
01_test_32.txt AC 1 ms 3772 KB
01_test_33.txt AC 5 ms 3768 KB
01_test_34.txt AC 1 ms 3780 KB
01_test_35.txt AC 5 ms 3576 KB
01_test_36.txt AC 4 ms 3656 KB
01_test_37.txt AC 5 ms 3660 KB
01_test_38.txt AC 1 ms 3656 KB
01_test_39.txt AC 5 ms 3852 KB
01_test_40.txt AC 1 ms 3656 KB
01_test_41.txt AC 6 ms 3852 KB
01_test_42.txt AC 1 ms 3656 KB
01_test_43.txt AC 6 ms 3788 KB
01_test_44.txt AC 1 ms 3800 KB
01_test_45.txt AC 12 ms 5404 KB


2025-03-05 (Wed)
20:48:01 +00:00