| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 37592 | alenam0161 | Bank (IZhO14_bank) | C++14 | 1067 ms | 37028 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using ll = long long;
using ld = long double;
const int inf = 1000 * 1000 * 1000 + 7;
using namespace std;
const int N = 207;
vector<int> a, b;
int ast = 0;
float st = 0;
map < pair<float, int>, bool> mp;
void rek() {
if (st == a.size() - 1&&a[st]==0) {
cout << "YES"; exit(0);
}
if (a[st] == 0) { st++; rek(); st--; }
if (mp[{ {st}, ast}] == true)return;
mp[{ {st}, ast}] = true;
for (int j = 0; j < b.size(); ++j) {
if (a[st] >= b[j]) {
if (b[j] > 0) {
int k = b[j];
a[st] -= k; b[j] -= k; ast += (1 << j);
rek();
a[st] += k; b[j] += k; ast -= (1 << j);
}
}
else break;
}
}
int main()
{
ios_base::sync_with_stdio(false);
int n, m;
cin >> n >> m;
for (int i = 0; i < n; ++i) {
int k; cin >> k; a.push_back(k);
}
for (int i = 0; i < m; ++i) {
int k; cin >> k; b.push_back(k);
}
sort(a.begin(), a.end());
sort(b.begin(), b.end());
rek();
cout << "NO" << endl;
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... | ||||
