제출 #1215153

#제출 시각아이디문제언어결과실행 시간메모리
1215153sakura은행 (IZhO14_bank)C++20
25 / 100
1095 ms328 KiB
// #define ONLINE_JUDGE
#include "bits/stdc++.h"
using namespace std;
#if __has_include("cleanup/debug.h") && (!defined(ONLINE_JUDGE))
    #include "cleanup/debug.h"
#else
    #pragma message("debug.h not found, or ONLINE_JUDGE defined.")
    #define print(...) ((void)0)
    #define printarr(...) ((void)0)
#endif
using ll = long long;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define kill(x) return void(cout << (x));
#define each(x, v) for (auto &x : (v))
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}else return 0;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}else return 0;}
template<class T> void getv(T& v) {each(i, v)cin>>i;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T> T rnglr(T l, T r) {return uniform_int_distribution<T>(l, r)(rng);}
void solve();
int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);
    // freopen("area.in", "r", stdin);
    int tt = 1;
    // cin >> tt;
    while(tt--) {
        solve();
        if(tt) cout << '\n';
    }return 0;
}

void solve() {
    int n, m, t; cin >> n >> m;
    int po[n], ba[m];
    for (int i = 0; i < n; i++)
        cin >> po[i];
    for (int i = 0; i < m; i++)
        cin >> ba[i];

    sort(ba, ba+m);
    do {
        int sum = 0, ptr = 0;
        for (int i = 0; i < m; i++) {
            sum += ba[i];
            if (sum == po[ptr])
                ptr++, sum = 0;
        }
        if (ptr == n) {
            kill("YES");
        }
    } while(next_permutation(ba, ba+m));
    cout << "NO";
}

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

bank.cpp:7:66: note: '#pragma message: debug.h not found, or ONLINE_JUDGE defined.'
    7 |     #pragma message("debug.h not found, or ONLINE_JUDGE defined.")
      |                                                                  ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...