Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- typedef double ld;
- using namespace std;
- ll mas[150000];
- void solve() {
- int j = 0;
- unordered_map <ll, ll> t;
- while (cin >> mas[j++]) {}
- j--;
- ll need = mas[j - 1];
- --j;
- for (int i = 0; i < j; ++i) t[mas[i]]++;
- for (int i = 0; i < j; ++i) {
- if ((need - mas[i] != mas[i] && t.count(need - mas[i]))) {
- cout << min(mas[i], need - mas[i]) << ' ' << need - min(mas[i], need - mas[i]);
- return;
- }
- else if (need - mas[i] == mas[i] && t[need - mas[i]] > 1) {
- cout << mas[i] << ' ' << mas[i];
- return;
- }
- }
- cout << -1;
- }
- int main() {
- ios::sync_with_stdio(false);
- cin.tie(0);
- #ifdef arrias
- freopen("true.txt", "r", stdin);
- #endif
- solve();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement