#include <iostream> #include <set> #include <algorithm> using namespace std; int main() { int n, m; cin >> n >> m; multiset<int> tickets; for (int i = 0; i < n; i++) { int ticket; cin >> ticket; tickets.insert(ticket); } for (int i = 0; i < m; i++) { int price; cin >> price; auto it = tickets.upper_bound(price); if (it == tickets.begin()) { cout << -1 << endl; } else { it--; cout << *it << endl; tickets.erase(it); } } return 0; } Frontend
Source:https://dev.to/guhan29/concert-tickets-cses-algoritmit-ongelmanratkaisussa-1635
Concert Tickets | CSES - Algoritmit ongelmanratkaisussa
dev.to0 views
Previous286 pages, zero orphans: the unglamorous part of launching a content siteNextMidjourney v6.1 vs Flux 1.1 Pro vs Sora: Exact Prompt Syntax Cheat Sheet (2026)
Related posts
Dynatrace Managed SLO: configuration, limits and API (tutorial)
0dev.to
Make the agent use the existing feature-flag hook, not a hardcoded boolean
0dev.to
Fixing Cross-Tab Real-Time Syncing in React: Patching useIndexedDB
0dev.to
Our model bake-off commits 2,436 bytes and gitignores 640,036, because the inputs are other people's comments
0dev.to
Two logical properties and 110 physical ones, so I set dir=rtl on all 106 of our pages
0dev.to
Flag a shared comparator before pooling trial results
0dev.to