Submission #262113

#TimeUsernameProblemLanguageResultExecution timeMemory
262113ElyesChaabouniTeams (IOI15_teams)C++14
34 / 100
4074 ms19696 KiB
#include "teams.h" /*#pragma GCC optimize("O3")*/ #include<bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#define ordered_set tree<int, null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> #define eps 1e-9 #define MOD1 998244353 #define MOD2 1000000007 #define INV_10 299473306 #define INF 1000000001 #define PI 3.14159265358979323846 using namespace std; int n; vector<pair<int, int> >v; bool compare(pair<int, int>a, pair<int, int>b) { if(a.second != b.second) return a.second < b.second; return a.first < b.first; } void init(int N, int A[], int B[]) { n=N; for(int i = 0; i < n; i++) v.push_back(make_pair(A[i], B[i])); sort(v.begin(), v.end(), compare); } int can(int M, int K[]) { sort(K, K+M); int idx=n-1; priority_queue<int>pq; for(int i = M-1; i >= 0; i--) { int cu=0; while(idx >= 0 && v[idx].second >= K[i]) { pq.push(v[idx].first); idx--; } while(!pq.empty() && cu < K[i]) { if(pq.top() <= K[i]) cu++; pq.pop(); } if(cu!=K[i]) 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...