Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <unordered_map>
- using namespace std;
- int main() {
- int n;
- long long x;
- cin >> n >> x;
- unordered_map<long long, int> seen;
- for (int i = 1; i <= n; ++i) {
- long long num;
- cin >> num;
- long long complement = x - num;
- if (seen.count(complement)) {
- // Found the pair
- cout << seen[complement] << " " << i << endl;
- return 0;
- }
- seen[num] = i;
- }
- cout << "IMPOSSIBLE" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement