Submission #1107303

#TimeUsernameProblemLanguageResultExecution timeMemory
1107303vjudge1Bank (IZhO14_bank)C++17
0 / 100
2 ms2640 KiB
#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...

Compilation message (stderr)

bank.cpp: In function 'void solve()':
bank.cpp:56:27: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         for (int j = 0; j < kek[i].size(); j++) {
      |                         ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...