MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CSES/Sorting/Concert.cc:5–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#define endl '\n'
4
5int main(){
6 ios_base::sync_with_stdio(false),cin.tie(nullptr);
7
8 int n, m; cin >> n >> m;
9 multiset<int> x;
10 for (int i = 0; i < n; ++i) {
11 int l; cin >> l;
12 x.insert(l);
13 }
14
15 for (int i = 0; i < m; ++i) {
16 int val; cin >> val;
17 auto it = x.upper_bound(val);
18 if (it == x.begin()) {
19 cout << -1 << endl;
20 } else {
21 --it;
22 cout << *it << endl;
23 x.erase(it);
24 }
25 }
26 return 0;
27}
28
29
30// 5 3 7 8 5

Callers

nothing calls this directly

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected