Submission #1007896

#TimeUsernameProblemLanguageResultExecution timeMemory
1007896arashmemarBank (IZhO14_bank)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; long long int a[30], b[30]; int dp[(1 << 20) + 20], ps[30]; int main() { int n, m; stdin >> n >> m; for (int i = 0;i < n;i++) { stdin >> a[i]; } ps[0] = a[0]; for (int i = 1;i < n;i++) { ps[i] = ps[i-1] + a[i]; } for (int i = 0;i < m;i++) { stdin >> b[i]; } for (long long int mask = 1; mask < (1 << m);mask++) { int c = 1; int s = 0; for (int i = 0;i < m;i++) { if (mask & c) { s += b[i]; dp[mask] = max(dp[mask], dp[mask - c]); } c *= 2; } if (s == ps[dp[mask]]) { dp[mask]++; } } if (dp[(1 << m) - 1] == n) { stdout << "YES"; } else { stdout << "NO"; } return 0; }

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:11:8: error: invalid operands of types 'FILE*' and 'int' to binary 'operator>>'
   11 |  stdin >> n >> m;
      |        ^~ ~
      |           |
      |           int
bank.cpp:14:9: error: invalid operands of types 'FILE*' and 'long long int' to binary 'operator>>'
   14 |   stdin >> a[i];
      |         ^~ ~~~~
      |               |
      |               long long int
bank.cpp:23:9: error: invalid operands of types 'FILE*' and 'long long int' to binary 'operator>>'
   23 |   stdin >> b[i];
      |         ^~ ~~~~
      |               |
      |               long long int
bank.cpp:45:10: error: invalid operands of types 'FILE*' and 'const char [4]' to binary 'operator<<'
   45 |   stdout << "YES";
      |          ^~ ~~~~~
      |             |
      |             const char [4]
bank.cpp:49:10: error: invalid operands of types 'FILE*' and 'const char [3]' to binary 'operator<<'
   49 |   stdout << "NO";
      |          ^~ ~~~~
      |             |
      |             const char [3]