#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
Personal vs Organization Developer Account on Google Play, and How to Get Useful User Feedback Once Your Test Starts
0dev.to
Distinct Values Subarrays II | CSES - Algoritmit ongelmanratkaisussa
0dev.to
A Practical Checklist for Mobile Browser Games Built With HTML5
0dev.to
One React Component, Two Layouts: A Pattern for Better UI Architecture
0HackerNoon
How One RGB Formula Transformed My Entire Portfolio
0HackerNoon
Dynatrace Managed SLO: configuration, limits and API (tutorial)
0dev.to