CSES - Concert Tickets

本文最後更新於:2025年7月20日 早上

CSES - Concert Tickets

Concert-Tickets.cpp

// Author : ysh
// 2025/03/29 Sat 19:29:12
// https://cses.fi/problemset/task/1091
#include<bits/stdc++.h>
using namespace std;
#include<slow>
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int a,b;cin>>a>>b;
    vc<int>f(a), g(b);
    cin>>f>>g;

    // sort(all(f));
    multiset<int, greater<int>> s(all(f));
    
    repo(&i, g) {
        auto found = s.lower_bound(i);
        if(found == s.end()) outl(-1);
        else {
            outl(*found);
            s.erase(found);
        }
    }
    return 0;
}

CSES - Concert Tickets
http://mysh212.github.io/algosolution/Concert-Tickets.cpp/
作者
ysh
發布於
2025年3月29日
更新於
2025年7月20日
許可協議