이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
/*
This code belongs to Aadit Ambadkar
Date: 2022-01-25 21:41:41
Problem: bank
*/
#include <bits/stdc++.h>
using namespace::std;
typedef long long ll;
#define F0R(i, n) for (int i = 0; i < n; i++)
#define R0F(i, n) for (int i = n-1; i >= 0; i--)
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define fastio ios::sync_with_stdio(0); cin.tie(0)
#define MOD 1000000007
#define FF first
#define SS second
int main() {
fastio;
int n, m; cin >> n >> m;
if (n==1) {
int k; cin >> k;
vector<int> arr(m, 0);
F0R(i, m) cin >> arr[i];
sort(arr.begin(), arr.end());
set<int> psbl;
psbl.insert(0);
F0R(i, m)
for (auto it = psbl.rbegin(); it != psbl.rend(); it++) {
psbl.insert((*it)+arr[i]);
}
if (psbl.count(k)) {
cout << "YES\n";
} else {
cout << "NO\n";
}
} else {
cout << "NO\n";
}
}
# | 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... |