Submission #1333188

#TimeUsernameProblemLanguageResultExecution timeMemory
1333188kawhietTeams (IOI15_teams)C++20
0 / 100
64 ms12940 KiB
#include <bits/stdc++.h>
#include "teams.h"
using namespace std;

int n;
vector<int> a, b, p;

void init(int N, int A[], int B[]) {
    n = N;
    a.assign(A, A + N);
    b.assign(B, B + N);
    p.resize(n + 2);
    for (int i = 0; i < n; i++) {
        p[a[i]]++;
        p[b[i] + 1]--;
    }
    for (int i = 1; i <= n; i++) {
        p[i] += p[i - 1];
    }
}

int can(int M, int K[]) {
    int m = M;
    vector<int> k;
    k.assign(K, K + M);
    ranges::sort(k);
    auto b = p;
    for (auto x : k) {
        if (b[x] < x) {
            return 0;
        }
        b[x] -= x;
    }
    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...