Submission #8105

#TimeUsernameProblemLanguageResultExecution timeMemory
8105baneling100Bank (IZhO14_bank)C++98
71 / 100
1074 ms604 KiB
#include <stdio.h> #include <stdlib.h> int N, M, A[21], B[21]; void input(void) { int i; scanf("%d %d",&N,&M); for(i=1 ; i<=N ; i++) scanf("%d",&A[i]); for(i=1 ; i<=M ; i++) scanf("%d",&B[i]); } void BitMask(int Lev, int Sum, int Bit, int S) { if(Lev>N) { printf("YES"); exit(0); } else { if(Sum) for(int i=S ; i<M ; i++) { if(!(Bit&(1<<i)) && Sum>=B[i+1]) BitMask(Lev,Sum-B[i+1],Bit|(1<<i),i+1); } else BitMask(Lev+1,A[Lev+1],Bit,0); } } int main(void) { input(); BitMask(1,A[1],0,0); printf("NO"); return 0; }

Compilation message (stderr)

bank.cpp: In function 'void input()':
bank.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d",&N,&M);
     ~~~~~^~~~~~~~~~~~~~~
bank.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&A[i]);
         ~~~~~^~~~~~~~~~~~
bank.cpp:14:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&B[i]);
         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...