| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 385200 | Aryan_Raina | Bank (IZhO14_bank) | C++14 | 466 ms | 120792 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define int long long
#define ld long double
#define ar array
const int INF = 1e15;
const int MOD = 1e9+7;
const int LIMIT = 1e18;
const int MXN = 21;
int a[MXN], b[MXN], can[MXN][1<<MXN];
vector<int> smh[1005*MXN];
vector<int> dp[MXN];
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m; cin>>n>>m;
for (int i = 0; i < n; i++) cin>>a[i];
for (int i = 0; i < m; i++) cin>>b[i];
for (int i = 0; i < 1<<m; i++) {
int sum = 0;
for (int j = 0; j < m; j++) if ((i>>j) & 1) {
sum += b[j];
}
smh[sum].push_back(i);
}
dp[0] = {0}; can[0][0] = 1;
for (int i = 0; i < n; i++) {
for (int j : dp[i]) {
for (int x : smh[a[i]]) if ((j & x) == 0 && !can[i+1][j^x]) {
dp[i+1].push_back(j ^ x);
can[i+1][j ^ x] = 1;
}
}
}
if (dp[n].size() > 0) {
cout<<"YES\n";
} else cout<<"NO\n";
} 컴파일 시 표준 에러 (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... | ||||
