제출 #852630

#제출 시각아이디문제언어결과실행 시간메모리
852630t6twotwo은행 (IZhO14_bank)C++17
25 / 100
1039 ms432 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; cin >> N >> M; vector<int> a(N); for (int i = 0; i < N; i++) { cin >> a[i]; } vector<int> b(M); for (int i = 0; i < M; i++) { cin >> b[i]; } sort(b.begin(), b.end()); do { int i = 0; for (int j = 0, s = 0; j < M; j++) { if (s + b[j] <= a[i]) { s += b[j]; } if (a[i] == s) { s = 0; if (++i == N) { cout << "YES\n"; return 0; } } } } while (next_permutation(b.begin(), b.end())); cout << "NO\n"; return 6/22; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...