Submission #707682

#TimeUsernameProblemLanguageResultExecution timeMemory
707682SamNguyenTeams (IOI15_teams)C++14
0 / 100
132 ms9100 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()); set<int> rights; auto it = students.begin(); for (int g : groups) { while (it != students.end() and it->first <= g) { rights.insert(it->second); it++; } if (rights.empty() or *rights.begin() < g) return false; rights.erase(rights.begin()); } 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...