제출 #1218575

#제출 시각아이디문제언어결과실행 시간메모리
1218575LIA팀들 (IOI15_teams)C++17
34 / 100
4093 ms43780 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef tuple <ll,ll,ll> plll;
typedef vector <plll> vplll;
typedef pair <ll,ll> pll;
typedef vector <ll> vll;
typedef vector <pll> vpll;
typedef vector <vector <pll>> vvpll;
typedef vector <vector <ll>> vvll;
typedef vector <bool> vb;
typedef vector <vector <bool>> vvb;
#define loop(i, s, e) for (ll i = (s); i < (e); ++i)
#define loopr(i, e, s) for (ll i = (e)-1; i >= (s); --i)
#define all(a) a.begin(), a.end()
const ll inf = 1e9 + 7;
ll n;
multiset<pll> p;
void init(int N, int A[], int B[]) {
    n = N;
    loop(i,0,n) {
        ll a = A[i], b = B[i];
        p.insert({a,b});
    }
}
int can(int m, int K[]) {
    vll k(m);
    loop(i,0,m) k[i] = K[i];
    sort(all(k));
    vpll kids(p.begin(), p.end());
    multiset<ll> bs;
    int idx = 0;
    int szp = kids.size();
    loop(i,0,m) {
        ll size = k[i];
        while (idx < n && kids[idx].first <= size) {
            bs.insert(kids[idx].second);
            ++idx;
        }
        loop(rep,0,size) {
            auto it = bs.lower_bound(size);
            if (it == bs.end()) return 0;
            bs.erase(it);
        }
    }
    return 1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...