Submission #2773831


Source Code Expand

Copy
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>

using namespace std;
int n,l;
int a[277777];
pair<int,int> fm[277777],sm[277777];//num,pos
int main()
{
	scanf("%d",&n);l=1<<n;
	for(int i=0;i<l;i++)scanf("%d",&a[i]);
	int ans=0;
	for(int i=0;i<l;i++)
	{
		fm[i]=make_pair(a[i],i);sm[i]=make_pair(0,0);
		for(int b=0;b<n;b++)
		{
			if(i&(1<<b))
			{
				int x=i-(1<<b);
				if(fm[x]>fm[i])
				{
					fm[i]=fm[x];
				}
				if(fm[x]>sm[i]&&fm[x].second!=fm[i].second)
				{
					sm[i]=fm[x];
				}
				if(sm[x]>sm[i])
				{
					sm[i]=sm[x];
				}
			}
		}
		if(a[i]>sm[i].first&&fm[i].second!=i)sm[i]=make_pair(a[i],i);
		ans=max(ans,fm[i].first+sm[i].first);
		if(i)printf("%d\n",ans);
	}
	return 0;
}

Submission Info

Submission Time
Task E - Or Plus Max
User Suika_predator
Language C++14 (GCC 5.4.1)
Score 0
Code Size 806 Byte
Status WA
Exec Time 92 ms
Memory 8320 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&n);l=1<<n;
                ^
./Main.cpp:15:39: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<l;i++)scanf("%d",&a[i]);
                                       ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 700
Status
AC × 3
AC × 17
WA × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_25.txt, subtask_1_26.txt, subtask_1_27.txt, subtask_1_28.txt, subtask_1_29.txt
Case Name Status Exec Time Memory
sample_01.txt AC 4 ms 2304 KB
sample_02.txt AC 2 ms 2304 KB
sample_03.txt AC 2 ms 2304 KB
subtask_1_01.txt AC 2 ms 2304 KB
subtask_1_02.txt AC 2 ms 2304 KB
subtask_1_03.txt WA 11 ms 2816 KB
subtask_1_04.txt AC 2 ms 2304 KB
subtask_1_05.txt WA 2 ms 2304 KB
subtask_1_06.txt WA 4 ms 2432 KB
subtask_1_07.txt WA 4 ms 2432 KB
subtask_1_08.txt WA 2 ms 2304 KB
subtask_1_09.txt AC 2 ms 2304 KB
subtask_1_10.txt WA 6 ms 2560 KB
subtask_1_11.txt AC 2 ms 2304 KB
subtask_1_12.txt AC 11 ms 3072 KB
subtask_1_13.txt WA 2 ms 2304 KB
subtask_1_14.txt WA 92 ms 8320 KB
subtask_1_15.txt AC 2 ms 2304 KB
subtask_1_16.txt WA 91 ms 8320 KB
subtask_1_17.txt WA 82 ms 6784 KB
subtask_1_18.txt AC 80 ms 8192 KB
subtask_1_19.txt AC 80 ms 8320 KB
subtask_1_20.txt WA 83 ms 8320 KB
subtask_1_21.txt WA 92 ms 8320 KB
subtask_1_22.txt WA 92 ms 8320 KB
subtask_1_23.txt WA 90 ms 8320 KB
subtask_1_24.txt WA 82 ms 6784 KB
subtask_1_25.txt AC 80 ms 8192 KB
subtask_1_26.txt AC 81 ms 8320 KB
subtask_1_27.txt WA 83 ms 8320 KB
subtask_1_28.txt WA 91 ms 8320 KB
subtask_1_29.txt WA 91 ms 8320 KB