| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 734501 | keta_tsimakuridze | 은행 (IZhO14_bank) | C++14 | 139 ms | 8560 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define f first
#define s second
#define int long long
#define pii pair<int,int>
using namespace std;
const int N = 20 , mod = 1e9 + 7; // !
int t, a[N], b[N];
int dp[(1 << N)];
main(){
int n, m;
cin >> n >> m;
for(int i = 0; i < n; i++) cin >> a[i], a[i] += a[i - 1];
for(int i = 0; i < m; i++) cin >> b[i];
for(int i = 0; i < (1 << m); i++) {
int cur = 0;
for(int j = 0; j < m; j++) if((1 << j) & i) cur += b[j];
for(int j = 0; j < m; j++) {
if((1 << j) & i) {
dp[i] = max(dp[i], dp[i ^ (1 << j)] + (a[dp[i ^ (1 << j)]] == cur));
}
}
// cout << i << " __ " << a[dp[i] + 1] << endl;
}
cout << (dp[(1 << m) - 1] == n ? "YES" : "NO");
}
컴파일 시 표준 에러 (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... | ||||
