Submission #330142
Source Code Expand
#include<bits/stdc++.h>
using namespace std;
int n,m,j,k,i,l;
int A[100000];
int B[100000];
int dp[150005];
int mx = -541;
void f(int x,int z,int q){
/* getchar();
cout << x << ' ' << z << ' ' << q << endl;
*/
if(x == n)
{
mx = max(q,mx);
return ;
}
if(x > n)
return ;
if(z > m+k)
return ;
f(x,z+1,q);
if(z > m)
f(x+B[z-m],z+1,q+B[z-m]-1);
else
f(x+A[z],z+1,q+A[z]);
}
int main(){
int a = -1;
scanf("%d %d %d",&n,&m,&k);
for(i=1 ; i<=m ; i++)
{
scanf("%d",&A[i]);
a = max(a,A[i]);
}
for(i=1 ; i<=k ; i++)
{
scanf("%d",&B[i]);
a = max(a,A[i]);
}
f(0,1,0);
printf("%d",max(a-1,mx));
return 0;
}
Submission Info
Submission Time
2015-02-02 17:10:39+0900
Task
14 - Farmer
User
Kerem
Language
C++ (G++ 4.6.4)
Score
0
Code Size
790 Byte
Status
WA
Exec Time
1034 ms
Memory
1064 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:41:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:45:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:51:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
Judge Result
Set Name
Set01
Set02
Set03
Set04
Set05
Set06
Set07
Set08
Set09
Set10
Set11
Set12
Set13
Set14
Set15
Set16
Set17
Set18
Set19
Set20
Score / Max Score
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
0 / 5
Status
Set Name
Test Cases
Set01
01
Set02
02
Set03
03
Set04
04
Set05
05
Set06
06
Set07
07
Set08
08
Set09
09
Set10
10
Set11
11
Set12
12
Set13
13
Set14
14
Set15
15
Set16
16
Set17
17
Set18
18
Set19
19
Set20
20
Case Name
Status
Exec Time
Memory
01
WA
23 ms
796 KB
02
WA
24 ms
800 KB
03
WA
24 ms
800 KB
04
WA
22 ms
928 KB
05
WA
24 ms
804 KB
06
TLE
1032 ms
928 KB
07
TLE
1032 ms
928 KB
08
TLE
1030 ms
940 KB
09
TLE
1030 ms
932 KB
10
TLE
1032 ms
932 KB
11
TLE
1032 ms
1060 KB
12
TLE
1031 ms
1048 KB
13
TLE
1033 ms
1052 KB
14
TLE
1034 ms
932 KB
15
TLE
1034 ms
928 KB
16
TLE
1033 ms
1056 KB
17
TLE
1032 ms
1060 KB
18
TLE
1031 ms
1064 KB
19
TLE
1032 ms
1064 KB
20
TLE
1031 ms
936 KB