Submission #484868

#TimeUsernameProblemLanguageResultExecution timeMemory
484868imachugTeams (IOI15_teams)C++17
34 / 100
4061 ms9448 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; vector<pair<int, int>> students; void init(int n, int a[], int b[]) { for(int i = 0; i < n; i++) { students.emplace_back(a[i], b[i]); } sort(students.begin(), students.end(), [](pair<int, int> p1, pair<int, int> p2) { return p1.second < p2.second; }); } int can(int m, int k[]) { multiset<pair<int, int>> projects; for(int i = 0; i < m; i++) { projects.insert(make_pair(k[i], k[i])); } for(auto [l, r]: students) { auto it = projects.lower_bound(make_pair(l, 0)); if(it != projects.end() && it->first <= r) { auto p = *it; projects.erase(it); p.second--; if(p.second > 0) { projects.insert(p); } } } return projects.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...