Submission #793163

#TimeUsernameProblemLanguageResultExecution timeMemory
793163PixelCatTeams (IOI15_teams)C++14
34 / 100
4064 ms16664 KiB
#ifdef NYAOWO #include "grader.cpp" #endif #include "teams.h" #include <bits/stdc++.h> #define For(i, a, b) for(int i = a; i <= b; i++) #define Forr(i, a, b) for(int i = a; i >= b; i--) #define F first #define S second #define all(x) x.begin(), x.end() #define sz(x) ((int)x.size()) #define eb emplace_back using namespace std; using LL = long long; using pii = pair<int, int>; const int MAXN = 100'000; int n; pii a[MAXN + 10]; // {mn, mx} void init(int N, int A[], int B[]) { n = N; For(i, 1, n) a[i] = pii(A[i - 1], B[i - 1]); sort(a + 1, a + n + 1); } int can(int M, int K[]) { sort(K, K + M); priority_queue<int, vector<int>, greater<int>> pq; int ptr = 1; For(i, 0, M - 1) { int x = K[i]; while(ptr <= n && a[ptr].F <= x) { pq.emplace(a[ptr].S); ptr++; } while(sz(pq) && pq.top() < x) pq.pop(); if(sz(pq) < x) return 0; For(_, 1, x) pq.pop(); } 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...