Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, k;
- cin >> n >> k;
- int niza[n];
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- for(int i = 0; i < n; i++) {
- int sum = k - niza[i];
- unordered_map<int, int> mapa;
- for(int j = 0; j < n; j++) {
- if(i != j) {
- if(mapa.count(sum - niza[j])) {
- cout << i + 1 << " " << mapa[sum - niza[j]] + 1 << " " << j + 1 << endl;
- return 0;
- }
- mapa[niza[j]] = j;
- }
- }
- }
- cout << "IMPOSSIBLE" << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement