제출 #1325561

#제출 시각아이디문제언어결과실행 시간메모리
1325561rainy3218은행 (IZhO14_bank)C++20
0 / 100
2 ms400 KiB
#include <bits/stdc++.h>
using namespace std;

int a[25];
int b[25];

int dp[1005];

int main() {
    freopen("bank.in", "r", stdin);
    freopen("bank.out", "w", stdout);

    int N, M;
    cin >> N >> M;

    for(int i = 1; i <= N; i++) cin >> a[i];

    for (int i = 1; i <= M; i++) cin >> b[i];

    dp[0] = 1;

    for (int i = 1; i <= M; i++) {
        for (int j = 1000; j >= b[i]; j--) {
            dp[j] = dp[j - b[i]] | dp[j];
        }
    }

    for(int i = 1; i <= N; i++) {
        if(dp[a[i]] == 0) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;
    return 0;
}

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

bank.cpp: In function 'int main()':
bank.cpp:10:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     freopen("bank.in", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:11:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     freopen("bank.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...