Submission #91055

#TimeUsernameProblemLanguageResultExecution timeMemory
91055YottaByteBank (IZhO14_bank)C++14
19 / 100
2 ms608 KiB
#include <stdio.h> using namespace std; const int N = 20 + 1; #define ll long long #define ok puts("OK"); int n, m, a[N], mx; int b[N], dp[(int)1e4]; main() { scanf("%d %d", &n, &m); for(int i = 1; i <= n; i++) scanf("%d", &a[i]); for(int i = 1; i <= m; i++) scanf("%d", &b[i]), mx += b[i]; dp[0] = 1; for(int i = 1; i <= m; i++) for(int j = mx; j >= b[i]; j--) if(dp[j - b[i]]) dp[j] = 1; if(dp[a[1]]) puts("YES"); else puts("NO"); }

Compilation message (stderr)

bank.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
bank.cpp: In function 'int main()':
bank.cpp:13: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:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
bank.cpp:18:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &b[i]), mx += 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...