Submission #707698

#TimeUsernameProblemLanguageResultExecution timeMemory
707698SamNguyenTeams (IOI15_teams)C++14
34 / 100
4042 ms12368 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; inline int IN_RANGE(int x, pair<int, int> p) { return p.first <= x and x <= p.second; } vector<pair<int, int>> students; void init(int N, int L[], int R[]) { students.resize(N); for (int i = 0; i < N; i++) students[i] = make_pair(L[i], R[i]); sort(students.begin(), students.end()); } int can(int M, int K[]) { vector<int> groups(K, K + M); sort(groups.begin(), groups.end()); priority_queue<int, vector<int>, greater<int>> rights; auto it = students.begin(); for (int g : groups) { while (it != students.end() and it->first <= g) { rights.push(it->second); it++; } for (int cnt = g; cnt > 0; ) { if (rights.empty()) return false; if (rights.top() >= g) cnt--; rights.pop(); } } return true; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...