1 条题解
-
3
没人来我来
#include <bits/stdc++.h> #define ll long long #define re register int #define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); using namespace std; const int MAXN = 1e6 + 5; int n, a[MAXN], m, q; int main() { IOS; cin >> n >> m; for (re i = n; i >= 1; i--) cin >> a[i]; for (re i = 1; i <= m; i++) { cin >> q; int x = lower_bound(a + 1, a + n + 1, q) - a; while (a[x] == q) x++; cout << (a[x] == 0 ? -1 : a[x]) << " "; } return 0; }
- 1
信息
- ID
- 627
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 3
- 标签
- (无)
- 递交数
- 131
- 已通过
- 73
- 上传者