diff --git a/problem/P2249/P2249.cpp b/problem/P2249/P2249.cpp new file mode 100644 index 00000000..d1c34472 --- /dev/null +++ b/problem/P2249/P2249.cpp @@ -0,0 +1,24 @@ +#include + +using namespace std; + +int main() { + int n, t, m; + vector nums; + cin >> n >> m; + for (int i = 0; i < n; i++) { + cin >> t; + nums.push_back(t); + } + for (int i = 0; i < m; i++) { + cin >> t; + vector::iterator it = lower_bound(nums.begin(), nums.end(), t); + if (*it == t) { + cout << it - nums.begin() + 1 << ' '; + } + else { + cout << "-1 "; + } + } + return 0; +}