Submission #7545151


Source Code Expand

Copy
#include <iostream>
#include <queue>
#include <math.h>
using namespace std;

struct data{
	unsigned long long x,y;
};

main(){
	unsigned long long n;
	unsigned long long k;
	data dp[2][2];
	
	cin>>n;
	cin>>dp[0][0].x;
	dp[0][1].x = dp[0][0].x;
	dp[0][0].y = dp[0][1].y = 0;
	
	for(int i=2;i<=n;i++){
		cin>>k;
		if( (dp[0][0].x) - (dp[0][1].x) + (dp[0][0].y^k) - (dp[0][1].y^k) > 0 ){
			dp[1][0].x = dp[0][0].y^k;
			dp[1][0].y = dp[0][0].x;
		}
		else{
			dp[1][0].x = dp[0][1].y^k;
			dp[1][0].y = dp[0][1].x;
		}
		
		if( (dp[0][0].x^k) - (dp[0][1].x^k) + ( dp[0][0].y ) - ( dp[0][1].y ) > 0 ){
			dp[1][1].x = dp[0][0].x^k;
			dp[1][1].y = dp[0][0].y;
		}
		else{
			dp[1][1].x = dp[0][1].x^k;
			dp[1][1].y = dp[0][1].y;
		}
		
		for(int i=0;i<=1;i++){
			dp[0][i].x = dp[1][i].x;
			dp[0][i].y = dp[1][i].y;
			//cout<<dp[0][i].x<<" "<<dp[0][i].y<<endl;
		}
		//cout<<endl;
	}
	cout<<max((dp[0][0].x)+(dp[0][0].y ) , (dp[0][1].x ) +( dp[0][1].y  ) )<<endl;
}

Submission Info

Submission Time
Task F - Xor Sum 3
User Ccucumber12
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1012 Byte
Status WA
Exec Time 70 ms
Memory 384 KB

Judge Result

Set Name Sample Subtask1
Score / Max Score 0 / 0 0 / 600
Status
AC × 1
WA × 2
AC × 12
WA × 41
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 sample_01.txt, sample_02.txt, sample_03.txt, sub1_01.txt, sub1_02.txt, sub1_03.txt, sub1_04.txt, sub1_05.txt, sub1_06.txt, sub1_07.txt, sub1_08.txt, sub1_09.txt, sub1_10.txt, sub1_11.txt, sub1_12.txt, sub1_13.txt, sub1_14.txt, sub1_15.txt, sub1_16.txt, sub1_17.txt, sub1_18.txt, sub1_19.txt, sub1_20.txt, sub1_21.txt, sub1_22.txt, sub1_23.txt, sub1_24.txt, sub1_25.txt, sub1_26.txt, sub1_27.txt, sub1_28.txt, sub1_29.txt, sub1_30.txt, sub1_small_01.txt, sub1_small_02.txt, sub1_small_03.txt, sub1_small_04.txt, sub1_small_05.txt, sub1_small_06.txt, sub1_small_07.txt, sub1_small_08.txt, sub1_small_09.txt, sub1_small_10.txt, sub1_small_11.txt, sub1_small_12.txt, sub1_small_13.txt, sub1_small_14.txt, sub1_small_15.txt, sub1_small_16.txt, sub1_small_17.txt, sub1_small_18.txt, sub1_small_19.txt, sub1_small_20.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt WA 1 ms 256 KB
sample_03.txt WA 1 ms 256 KB
sub1_01.txt AC 27 ms 256 KB
sub1_02.txt AC 31 ms 256 KB
sub1_03.txt AC 12 ms 256 KB
sub1_04.txt AC 49 ms 256 KB
sub1_05.txt WA 66 ms 256 KB
sub1_06.txt WA 67 ms 256 KB
sub1_07.txt WA 66 ms 256 KB
sub1_08.txt WA 66 ms 256 KB
sub1_09.txt WA 66 ms 256 KB
sub1_10.txt WA 67 ms 256 KB
sub1_11.txt WA 66 ms 256 KB
sub1_12.txt WA 66 ms 256 KB
sub1_13.txt WA 20 ms 256 KB
sub1_14.txt WA 62 ms 256 KB
sub1_15.txt WA 66 ms 256 KB
sub1_16.txt WA 67 ms 256 KB
sub1_17.txt WA 65 ms 256 KB
sub1_18.txt WA 70 ms 256 KB
sub1_19.txt WA 67 ms 256 KB
sub1_20.txt WA 67 ms 384 KB
sub1_21.txt WA 66 ms 256 KB
sub1_22.txt WA 66 ms 256 KB
sub1_23.txt WA 66 ms 256 KB
sub1_24.txt WA 67 ms 256 KB
sub1_25.txt WA 66 ms 256 KB
sub1_26.txt WA 67 ms 256 KB
sub1_27.txt WA 67 ms 256 KB
sub1_28.txt AC 6 ms 256 KB
sub1_29.txt AC 1 ms 256 KB
sub1_30.txt AC 16 ms 256 KB
sub1_small_01.txt WA 1 ms 256 KB
sub1_small_02.txt WA 1 ms 256 KB
sub1_small_03.txt WA 1 ms 256 KB
sub1_small_04.txt WA 1 ms 256 KB
sub1_small_05.txt WA 1 ms 256 KB
sub1_small_06.txt WA 1 ms 256 KB
sub1_small_07.txt WA 1 ms 256 KB
sub1_small_08.txt WA 1 ms 256 KB
sub1_small_09.txt WA 1 ms 256 KB
sub1_small_10.txt WA 1 ms 256 KB
sub1_small_11.txt AC 1 ms 256 KB
sub1_small_12.txt AC 1 ms 256 KB
sub1_small_13.txt AC 1 ms 256 KB
sub1_small_14.txt AC 1 ms 256 KB
sub1_small_15.txt WA 1 ms 256 KB
sub1_small_16.txt WA 1 ms 256 KB
sub1_small_17.txt WA 1 ms 256 KB
sub1_small_18.txt WA 1 ms 256 KB
sub1_small_19.txt WA 1 ms 256 KB
sub1_small_20.txt WA 1 ms 256 KB