Submission #761955

#TimeUsernameProblemLanguageResultExecution timeMemory
761955Dan4Life팀들 (IOI15_teams)C++17
34 / 100
4078 ms31464 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
vector<pair<int,int>> v; int n;
multiset<int> S;
 
void init(int N, int a[], int b[]) {
	for(int i = 0; i < N; i++) v.pb({a[i],b[i]});
	sort(begin(v),end(v)); n = N;
}
 
int can(int m, int a[]) {
    if(accumulate(a,a+m,0ll)>n) return 0;
    sort(a,a+m);
    int j = 0; S.clear();
    for(int i = 0; i < m; i++){
        int x = a[i];
        while(j<n and v[j].fi<=a[i]) 
            S.insert(v[j].se), j++;
        while(x--){
            auto itr = S.lower_bound(a[i]);
            if(itr==end(S)) return 0;
            S.erase(itr);
        }
    }
    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...