Submission #783359

#TimeUsernameProblemLanguageResultExecution timeMemory
783359MatblubeTeams (IOI15_teams)C++14
34 / 100
4083 ms17692 KiB
#include "teams.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define dbg(x) cerr<<#x<<": "<<x<<"\n";
#define fr(i, x) for(ll i=0 ; i<x ; i++)
#define fra(x, v) for(auto x:v)
#define fra1(x,v) for(auto &x:v)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define F first
#define S second

const ll maxN=5e6;
ll n;
pair<ll, ll> vp[maxN];
bool uwu[maxN];

void init(int N, int A[], int B[]) {
    n=N;
    fr(i, N){
        vp[i].F=B[i];
        vp[i].S=A[i];
    }
    sort(vp, vp+n);
}

int can(int M, int K[]) {
    sort(K, K+M);
    ll cc=0;
    fill(uwu, uwu+maxN, 0);
    fr(i, M){
        cc=0;
        fr(j, n){
            if(cc>=K[i]) break;
            if(uwu[j] || vp[j].F<K[i] || vp[j].S>K[i]) continue;
            cc++;
            uwu[j]=1;
        }
        if(cc!=K[i]) return 0;
    }
	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...