Solution
1091-Concert_Tickets.cpp
1#include<bits/stdc++.h>
2using namespace std;
3#define int long long
4signed main(){
5 ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
6 int n,m; cin>>n>>m;
7 map<int,int>mp;
8 while(n--){
9 int x; cin>>x;
10 ++mp[-x];
11 }
12 while(m--){
13 int x; cin>>x;
14 auto it=mp.lower_bound(-x);
15 if(it==mp.end()) cout<<"-1\n";
16 else{
17 cout<<-it->first<<'\n';
18 if(!--it->second) mp.erase(it);
19 }
20 }
21 return 0;
22}Editorial not yet generated for this problem. Run the editorial generation script to add hints and detailed explanations.