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