Submission #330137


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(){

   scanf("%d %d %d",&n,&m,&k);

   for(i=1 ; i<=m ; i++)
      scanf("%d",&A[i]);

   for(i=1 ; i<=k ; i++)
      scanf("%d",&B[i]);

   f(0,1,0);

   printf("%d",mx);

   return 0;
}

Submission Info

Submission Time
Task 14 - Farmer
User Kerem
Language C++ (G++ 4.6.4)
Score 0
Code Size 691 Byte
Status WA
Exec Time 1041 ms
Memory 1064 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:39:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:42:24: 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]

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
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
TLE × 1
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 924 KB
02 WA 23 ms 928 KB
03 WA 25 ms 808 KB
04 WA 24 ms 808 KB
05 WA 23 ms 932 KB
06 TLE 1034 ms 904 KB
07 TLE 1031 ms 936 KB
08 TLE 1032 ms 936 KB
09 TLE 1033 ms 936 KB
10 TLE 1030 ms 812 KB
11 TLE 1030 ms 1060 KB
12 TLE 1033 ms 1064 KB
13 TLE 1033 ms 988 KB
14 TLE 1031 ms 924 KB
15 TLE 1032 ms 932 KB
16 TLE 1031 ms 1052 KB
17 TLE 1033 ms 1060 KB
18 TLE 1041 ms 1052 KB
19 TLE 1033 ms 1060 KB
20 TLE 1032 ms 936 KB