이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <iostream>
//#pragma GCC optimize("Ofast")
#define ld long double
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
using namespace std;
//mt19937 gen(time(0));
const ll inf = 1e18 + 18;
vector <int> a, b;
main()
{
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("divide.in", "r", stdin);
//    freopen("divide.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // O(m! * max(n, m))
    int n, m;
    cin >> n >> m;
    if (n > m)
    {
        cout << "NO";
        return 0;
    }
    a.resize(n, 0);
    b.resize(m, 0);
    for(int i = 0; i < n; i++)
        cin >> a[i];
    for(int i = 0; i < m; i++)
        cin >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    bool xx = true;
    while(next_permutation(b.begin(), b.end()))
    {
        xx = false;
        vector <int> c = a;
        int i = 0;
        int j = 0;
        bool f = true;
        while(i < n && j < m)
        {
            if (c[i] > 0)
            {
                c[i] -= b[j];
                j++;
            }
            if (c[i] == 0)
            {
                i++;
            }
            if (c[i] < 0)
            {
                f = false;
                break;
            }
        }
        if (f && i == n)
        {
            cout << "YES";
            return 0;
        }
    }
    cout << "NO";
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
bank.cpp:20:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
bank.cpp: In function 'int main()':
bank.cpp:49:10: warning: variable 'xx' set but not used [-Wunused-but-set-variable]
     bool xx = true;
          ^~| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |