Editorial for 2184: Самий правий


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
#include <bits/stdc++.h>

using namespace std;

int main()
{
    freopen("a.in", "r", stdin); freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    unordered_map <int, int> pos;
    int len, reqs, in;

    cin >> len >> reqs;

    vector <int> arr(len);

    for (int i = 0; i < len; i ++) {
        cin >> arr[i];
        pos[arr[i]] = i + 1;
    }

    for (int i = 0; i < reqs; i ++) {
        cin >> in;
        cout << pos[in] << '\n';
    }
}

Коментарі

Please read the guidelines before commenting.


Ще немає коментарів.