Submission #330187


Source Code Expand

#include<bits/stdc++.h>

#define pb push_back

using namespace std;

int n,m,k,i,j;
int A[20004],B[20004],dp[1500004];
int ans,H[20005],x;

vector<int> V;

void f(){

   ans = x = i;
   n -= x;

   while(dp[x] != -1)
   {
      H[dp[x]] = 1;
      x -= A[dp[x]];
   }

   for(i=1 ; i<=m ; i++)
      if(!H[i])
         V.pb(A[i]);

   for(i=1 ; i<=k ; i++)
      V.pb(B[i]);

   sort(V.begin(),V.end());

   for(i=V.size()-1 ; i>=0 ; i--)
   {
      if(!n)
         break;
      ans += min(V[i],n)-1;
      n -= min(V[i],n);
   }
}

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]);

    sort(A+1,A+m+1);

    dp[0] = -1;

    for(i=1 ; i<=m ; i++)
        for(j=n ; j>=0 ; j--)
            if(!dp[A[i]+j] && dp[j])
                dp[A[i]+j] = i;

    for(i=n ; i>=0 ; i--)
        if(dp[i])
            break;

    printf("%d",ans);

   return 0;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:44:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:47:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:50:25: 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
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 1
WA × 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 928 KB
02 WA 26 ms 796 KB
03 WA 22 ms 804 KB
04 WA 24 ms 800 KB
05 WA 23 ms 800 KB
06 WA 23 ms 808 KB
07 WA 25 ms 804 KB
08 WA 25 ms 792 KB
09 WA 25 ms 800 KB
10 WA 24 ms 736 KB
11 WA 180 ms 1060 KB
12 WA 208 ms 1044 KB
13 WA 225 ms 1064 KB
14 WA 235 ms 1060 KB
15 WA 267 ms 1060 KB
16 WA 339 ms 1064 KB
17 WA 379 ms 1140 KB
18 WA 452 ms 1056 KB
19 WA 566 ms 1056 KB
20 WA 544 ms 1320 KB