Submission #1218539

#TimeUsernameProblemLanguageResultExecution timeMemory
1218539LIATeams (IOI15_teams)C++17
0 / 100
195 ms35676 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[]) {
    bool b= 1;
    loop(i,0,m) {
        ll sz = k[i];
        ll cnt = 0;
        for (auto [a,b]: p) {
            if (cnt==sz) break;
            if (a<=sz && b>=sz) {// match
                cnt++;
                p.erase(p.find({a,b}));
            }
        }
        if (cnt<sz) b= false;
    }
    return ((b)?1:0);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...