Submission #1140365

#TimeUsernameProblemLanguageResultExecution timeMemory
1140365ZheingTeams (IOI15_teams)C++20
34 / 100
4094 ms6980 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; } template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; } void dbg_out() { cerr << endl; } template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); } #ifdef LOCAL #define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__) #else #define dbg(...) #endif #define ar array #define ll long long #define ld long double #define sza(x) ((int)x.size()) #define all(a) (a).begin(), (a).end() const int MAX_N = 1e5 + 5; const ll MOD = 1e9 + 7; const ll INF = 1e9; const ld EPS = 1e-9; int N; vector<vector<int>> students(MAX_N); vector<int> teams(MAX_N, 0); void init(int _N, int A[], int B[]) { N = _N; for(int i = 0; i < N; ++i){ students[A[i]].push_back(B[i]); } } int can(int m, int K[]) { vector<int> requestCount(N + 1, 0); for(int i = 0; i < m; ++i) { requestCount[K[i]]++; } priority_queue<int, vector<int>, greater<int>> pq; for(int i = 1; i <= N; ++i) { for(int student : students[i]) { pq.push(student); } while(!pq.empty() && pq.top() < i) { pq.pop(); } if(pq.size() < i * requestCount[i]) { return 0; } for(int j = 0; j < i * requestCount[i]; ++j) { 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...