Submission #619979

#TimeUsernameProblemLanguageResultExecution timeMemory
619979yanndevTeams (IOI15_teams)C++17
34 / 100
4074 ms19120 KiB
#include "teams.h" #include <bits/stdc++.h> #define fi first #define se second using namespace std; const int MX_N = 500042; int n; pair<int, int> stud[MX_N]; void init(int N, int A[], int B[]) { for (int i = 0; i < N; i++) stud[i] = {A[i], B[i]}; n = N; sort(stud, stud + N); } int can(int M, int K[]) { sort(K, K + M); int nxt = 0; priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> ranges {}; for (int i = 0; i < M; i++) { while (nxt < n && stud[nxt].fi <= K[i]) { ranges.push({stud[nxt].se, stud[nxt].fi}); nxt++; } int req = K[i]; while (!ranges.empty() && req) { auto cur = ranges.top(); ranges.pop(); if (cur.fi >= K[i]) req--; } if (req != 0) return 0; } 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...