Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <algorithm>
- #include <map>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int k;
- cin >> k;
- int niza[n];
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- map<int, int> m;
- for(int i = 0; i < n; i++) {
- int razlika = k - niza[i];
- if(m.count(razlika)) {
- cout << i + 1 << " " << m[razlika] + 1 << endl;
- }
- m[niza[i]] = i;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement