| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1107303 | vjudge1 | 은행 (IZhO14_bank) | C++17 | 2 ms | 2640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define speed ios_base::sync_with_stdio(0), cin.tie(0)
#define int long long
#define st first
#define nd second
#define pb push_back
#define love our_kolhoz
using namespace std;
const int N = 1e5 + 10, inf = 1e18, mod = 1e9 + 7;
//koz qorqaq
int n, m;
vector<pair<int, int>> kek[N];
int used[1001];
void solve() {
cin >> n >> m;
int a[n], b[m];
for (int i = 0; i < n; i++) {
cin >> a[i];
used[a[i]]++;
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
for (int i = 0; i < m; i++) {
for (int j = i + 1; j < m; j++) {
kek[b[i] + b[j]].pb({i, j});
//cout << b[i] + b[j] << 'c' << i << ' ' << j << ' ' << kek[b[i] + b[j]].size() << '\n';
}
}
sort(kek, kek + 1000, [](vector<pair<int, int>> a, vector<pair<int, int>> b) {
return (a.size() < b.size());
});
map<int, bool> lol;
//cout << kek[8].size()<< ' ';
for (int i = 0; i <= 1000; i++) {
if (kek[i].size() == 0) {
//cout << "NdO" << i << ' ' << kek[i].size();
continue;
}
int kok = b[kek[i][0].st] + b[kek[i][0].nd];
//cout << kok << ' ';
if (!used[kok])
continue;
bool lel = 0;
for (int j = 0; j < kek[i].size(); j++) {
if (lol[kek[i][j].st] == 0 && lol[kek[i][j].nd] == 0) {
lol[kek[i][j].st] = 1;
lol[kek[i][j].nd] = 1;
lel = 1;
used[kok]++;
break;
}
}
if (!lel) {
cout << "NO";
return;
}
}
for (int i = 0; i < n; i++) {
if (used[a[i]] == 1) {
cout << "NO";
return;
}
}
cout << "YES";
}
signed main() {
speed;
//freopen("points.in ", "r", stdin);
//freopen("points.out", "w", stdout);
int _t = 1;
//cin >> _t;
while (_t--)
solve();
return 0;
}
// sau bol
// there's really no way of winning
// if in their eyes you'll always be a dumb blonde...
컴파일 시 표준 에러 (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... | ||||
