# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
390700 | ahmet | 은행 (IZhO14_bank) | C++14 | 25 ms | 360 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define zaman cout<<endl<<fixed<<setprecision(2)<<1000.0 * clock() / CLOCKS_PER_SEC<< " milliseconds "
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define mp make_pair
const int mx=1e6+6;
int a[22],b[22],dp[mx];
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n,m;cin >> n >> m;
ref(i,1,n)cin >> a[i];
ref(i,1,m)cin >> b[i];
sort(b+1,b+m+1);
dp[0]=1;
for(int i=m;i>0;--i){
int bank=b[i];
for(int s=1e6;s>0;--s){
if(s-bank<0)break;
if(dp[s-bank]){dp[s]=1;}
}
}
if(dp[a[1]])cout<<"YES"<<endl;
else cout << "NO"<<endl;
}
컴파일 시 표준 에러 (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... |