1 solutions
-
2
小贪不算贪
#include <bits/stdc++.h> using namespace std; int n, q; map<int, int>mp; int main() { cin >> n; for (int i = 1,a; i <= n; i++) { cin >> a; if (mp[a] == 0) { mp[a] = i; } } cin >> q; while (q--) { int x; cin >> x; if (mp[x] == 0) { cout << -1 << " "; } else { cout << mp[x] << " "; } } return 0; }
- 1
Information
- ID
- 511
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 9
- Tags
- # Submissions
- 16
- Accepted
- 2
- Uploaded By