Submission #606944

#TimeUsernameProblemLanguageResultExecution timeMemory
606944yuto1115Teams (IOI15_teams)C++17
34 / 100
4048 ms16416 KiB
#include "teams.h" #include "bits/stdc++.h" #define rep(i, n) for(ll i = 0; i < ll(n); ++i) #define rep2(i, s, n) for(ll i = ll(s); i < ll(n); ++i) #define rrep(i, n) for(ll i = ll(n)-1; i >= 0; --i) #define pb push_back #define eb emplace_back #define all(a) a.begin(),a.end() #define SZ(a) int(a.size()) using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vp = vector<P>; using vvp = vector<vp>; using vb = vector<bool>; using vvb = vector<vb>; using vs = vector<string>; const int inf = 1001001001; const ll linf = 1001001001001001001; template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } int n; vi a, b; void init(int N, int A[], int B[]) { n = N; a = vi(A, A + N); b = vi(B, B + N); for (int &i: b) ++i; } int can(int m, int K[]) { vi k = vi(K, K + m); sort(all(k)); vi ord(n); iota(all(ord), 0); sort(all(ord), [&](int i, int j) { return a[i] < a[j]; }); int it = 0; priority_queue<int, vi, greater<int>> pq; for (int i: k) { while (it < n and a[ord[it]] <= i) pq.push(b[ord[it++]]); while (not pq.empty() and pq.top() <= i) pq.pop(); rep(_, i) { if (pq.empty()) return 0; 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...