제출 #591072

#제출 시각아이디문제언어결과실행 시간메모리
591072Dan4Life팀들 (IOI15_teams)C++17
0 / 100
2833 ms23136 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define sz(a) (int)a.size() vector<pair<int,int>> v; int n; multiset<pair<int,int>> S; bool cmp(pair<int,int> a, pair<int,int> b){ if(a.se-a.fi==b.se-b.fi){ if(a.fi==b.fi) return a.se<b.se; return a.fi<b.fi; } return a.se-a.fi < b.se-b.fi; } void init(int N, int a[], int b[]) { for(int i = 0; i < N; i++) v.pb({a[i],b[i]}); sort(v.begin(),v.end(), cmp); n = sz(v); } int can(int m, int a[]) { S.clear(); for(int i = 0; i < m; i++) S.insert({a[i],a[i]}); for(int i = 0; i < n; i++){ auto itr = S.lower_bound({v[i].fi,-1}); if(itr==S.end()) break; auto cur = *itr; int x = cur.fi, y = cur.se; S.erase(itr); if(y!=1) S.insert({x,y-1}); } return S.empty(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...