Submission #330184


Source Code Expand

#include<bits/stdc++.h>

#define pb push_back

using namespace std;

int n,m,k,i,j;
int A[2004],B[2004],dp[150004];
int ans,H[2005],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 1015 Byte
Status WA
Exec Time 508 ms
Memory 1420 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 33 ms 868 KB
02 WA 27 ms 1032 KB
03 WA 29 ms 984 KB
04 WA 29 ms 1032 KB
05 WA 31 ms 836 KB
06 WA 29 ms 904 KB
07 WA 28 ms 900 KB
08 WA 31 ms 840 KB
09 WA 30 ms 836 KB
10 WA 30 ms 840 KB
11 WA 169 ms 1096 KB
12 WA 196 ms 1096 KB
13 WA 208 ms 1168 KB
14 WA 242 ms 1280 KB
15 WA 258 ms 1100 KB
16 WA 306 ms 1172 KB
17 WA 339 ms 1200 KB
18 WA 407 ms 1240 KB
19 WA 508 ms 1236 KB
20 WA 477 ms 1420 KB