제출 #268355

#제출 시각아이디문제언어결과실행 시간메모리
268355A02팀들 (IOI15_teams)C++14
0 / 100
115 ms16352 KiB
#include "teams.h"
#include <vector>
#include <set>
#include <algorithm>
#include <utility>
#include <queue>
#include <iostream>

using namespace std;

vector<pair<int, int> > intervals;

void init(int N, int A[], int B[]) {

    for (int i = 0; i < N; i++){
        intervals.push_back(make_pair(B[i], A[i]));
    }

    sort(intervals.begin(), intervals.end());
}

int can(int M, int K[]) {

    vector<long long> projects;

    for (int i = 0; i < M; i++){
        projects.push_back(K[i]);
    }

    sort(projects.begin(), projects.end());

    int c_student = 0;

    for (int i = 0; i < M; i++){
        int to_fill = K[i];

        while (intervals[c_student].first < K[i]){
            c_student++;
        }

        while (to_fill > 0 && intervals[c_student].second <= K[i]){
            c_student++;
            to_fill--;
        }

        if (to_fill != 0){
            cout << 0 << endl;
            return 0;
        }

    }
    cout << 1 << endl;
	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...