Submission #68464

#TimeUsernameProblemLanguageResultExecution timeMemory
68464ege_eksiBank (IZhO14_bank)C++14
52 / 100
1072 ms616 KiB
#include<iostream> #include<cstdio> #include<climits> #include<cstdlib> #include<cmath> #include<algorithm> using namespace std; int n , m; int a[20]; int b[20]; int cnt[1001]; bool f(int index) { if(index == n) { return true; } //printf("%d\n",a[index]); if(a[index] == 0) { return f(index+1); } for(int i = a[index] ; i > 0 ; i--) { if(cnt[i] > 0) { cnt[i]--; a[index] -= i; if(f(index) == true) { return true; } a[index] += i; cnt[i]++; } } return false; } int main() { scanf("%d %d",&n,&m); for(int i = 0 ; i < n ; i++) { scanf("%d",&a[i]); } for(int i = 0 ; i < m ; i++) { scanf("%d",&b[i]); cnt[b[i]]++; } if(f(0) == true) { printf("YES"); } else { printf("NO"); } return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:53:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
bank.cpp:57:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a[i]);
   ~~~~~^~~~~~~~~~~~
bank.cpp:62:8: 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...