제출 #565673

#제출 시각아이디문제언어결과실행 시간메모리
565673Halym2007Bank (IZhO14_bank)C++11
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define cont continue;
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 100005;
int n, m, kl[25], c[25], a[25], b[25];
bool kp;
void solve(int x) {
if (x == m + 1) {
for (int i = 1; i <= m; ++i) {
kl[c[i]] += b[i];
}
for (int i = 1; i <= n; ++i) {
if (kl[i] != a[i]) kp = 1;
}
if (!kp) {
cout << "YES\n";
exit(0);
}
for (int i = 1; i <= m; ++i) {
kl[c[i]] = 0;
}
kp = 0;
return;
}
for (int i = 0; i <= n; ++i) {
c[x] = i;
solve (x + 1);
}
}

int main() {
ios::sync_with_stdio(false);
  cin.tie(0);
    freopen("bank.in", "r", stdin);
    freopen("bank.out", "w", stdout);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= m; ++i) cin >> b[i];
  if (n > m) return cout << "NO\n", 0;
  solve (1);
  cout << "NO\n

컴파일 시 표준 에러 (stderr) 메시지

bank.cpp:46:11: warning: missing terminating " character
   46 |   cout << "NO\n
      |           ^
bank.cpp:46:11: error: missing terminating " character
   46 |   cout << "NO\n
      |           ^~~~~
bank.cpp: In function 'int main()':
bank.cpp:46:8: error: expected primary-expression at end of input
   46 |   cout << "NO\n
      |        ^~
bank.cpp:46:8: error: expected '}' at end of input
bank.cpp:36:12: note: to match this '{'
   36 | int main() {
      |            ^
bank.cpp:39:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |     freopen("bank.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:40:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |     freopen("bank.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~