# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
655757 | asiat | 은행 (IZhO14_bank) | C++14 | 1 ms | 212 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
main(){
cin.tie(0)->sync_with_stdio(0);
ifstream cin("bank.in");
ofstream cout("bank.out");
int n; cin >> n;
int m; cin >> m;
vector <int> v(n), g(m);
for (int i = 0; i < n; i++)cin >> v[i];
for (int i = 0; i < m; i++)cin >> g[i];
if(n > m){
cout << "NO" << endl;
return 0;
}
if(n == m){
sort(v.begin(), v.end());
sort(g.begin(), g.end());
if(v == g){
cout << "YES" << endl;
}else cout << "NO" << endl;
return 0;
}
if(n == 1){
vector <int> dp(v[0]+1);
dp[0] = 1;
for (int i = 0; i < m; i++){
for (int j = 1; j <= v[0]; j++){
if(j-g[i] >= 0 and dp[j-g[i]])dp[j] = 1;
}
}
if(dp[v[0]]){
cout << "YES" << endl;
}else cout << "NO" << endl;
return 0;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |