Submission #1165709


Source Code Expand

#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<cmath>
#include<string>

#define ls (t<<1)
#define rs ((t<<1)+1)
#define mid ((l+r)>>1)
#define fi first
#define se second
#define mk make_pair
#define pb push_back

#define N 1005
#define M 128
#define seed 23333

using namespace std;
const int inf=(int)1e9;
int i,j,m,n,p,k,f[N][M],T,d;
int main()
{
		scanf("%d",&T);
		for (;T--;)
		{
				memset(f,0,sizeof(f));
				for (i=0;i<M;++i) f[0][i]=-inf;
				scanf("%d%d",&n,&d); n--; f[0][d]=0;
				for (i=0;i<n;++i)
					for (j=0;j<M;++j)
						for (k=0;k<M;++k)
							f[i+1][k]=max(f[i+1][k],f[i][j]+(j^k));
				for (i=0;i<M;++i) f[n][0]=max(f[n][0],f[n][i]+i);
				printf("%d\n",f[n][0]); 
		}
}

Submission Info

Submission Time
Task C - Cookie Breeding Machine
User qiaoranliqu
Language C++14 (GCC 5.4.1)
Score 0
Code Size 834 Byte
Status TLE
Exec Time 1055 ms
Memory 768 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:29:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&T);
                 ^
./Main.cpp:34:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&d); n--; f[0][d]=0;
                        ^

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
AC × 1
TLE × 5
Set Name Test Cases
All 00_sample.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt
Case Name Status Exec Time Memory
00_sample.txt AC 2 ms 768 KB
random_00.txt TLE 1055 ms 768 KB
random_01.txt TLE 1055 ms 768 KB
random_02.txt TLE 1055 ms 768 KB
random_03.txt TLE 1055 ms 768 KB
random_04.txt TLE 1055 ms 768 KB