Submission #94721

#TimeUsernameProblemLanguageResultExecution timeMemory
94721someone_aaTeams (IOI15_teams)C++17
0 / 100
511 ms15640 KiB
#include <bits/stdc++.h>
#include "teams.h"
#define P pair<int,int>
#define pb push_back
#define mp make_pair
using namespace std;
int n;
vector<P>intervals;

void init(int N, int A[], int B[]) {
    n = N;
    for(int i=0;i<N;i++) {
        intervals.pb(mp(B[i], A[i]));
    }
    sort(intervals.begin(), intervals.end());

    for(auto i:intervals) {
        cout<<i.first<<" "<<i.second<<"\n";
    }

}

int OK[500100];

int can(int M, int K[]) {
    int pk = 0, pi = 0;

    sort(K, K+M);
    for(int i=0;i<M;i++) OK[i] = K[i];

    while(pk < M && pi < n) {
        if(OK[pk] >= intervals[pi].second && OK[pk] <= intervals[pi].first) {
            K[pk]--;
        }
        pi++;
        if(K[pk] == 0) pk++;
    }
	int sum = 0;
	for(int i=0;i<M;i++) {
        sum += K[i];
	}
	return (sum == 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...