| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 935969 | Bula | 은행 (IZhO14_bank) | C++17 | 81 ms | 16988 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9 + 7, N = 2e5 + 5;
main(){
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int tt = 1; //cin >> tt;
while(tt--){
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
for(int i = 0; i < n; i++) cin >> a[i];
for(int i = 0; i < m; i++) cin >> b[i];
vector<int> ans((1 << m), -1), left((1 << m), -1);
ans[0] = left[0] = 0;
for(int i = 0; i < (1 << m); i++){
for(int j = 0; j < m; j++){
if(!(i & (1 << j))) continue;
int p = i & ~(1 << j);
int sum = left[p] + b[j];
int need = a[ans[p]];
if(sum < need){
ans[i] = ans[p];
left[i] = sum;
}else if(sum == need){
ans[i] = ans[p] + 1;
left[i] = 0;
}
}
if(ans[i] == n){
cout << "YES" << endl;
return 0;
}
}
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... | ||||
