Submission #262173

#TimeUsernameProblemLanguageResultExecution timeMemory
262173amiratouTeams (IOI15_teams)C++14
21 / 100
4106 ms365160 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define ll long long int n,a[100005],b[100005]; vector<int> vec[100005]; bitset<100005> matched; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void init(int N, int A[], int B[]) { n=N; for (int i = 0; i < n; ++i) { a[i]=A[i]; b[i]=B[i]; } for (int i = 1; i <= n; ++i) for (int j = 0; j < n; ++j) if(a[j]<=i && i<=b[j])vec[i].pb(j); } int can(int M, int K[]) { sort(K,K+M); matched=0; for (int i = 0; i < M; ++i) { for (int j = 0; j < K[i]; ++j) { int mini=(int)1e9,idx; for(auto it:vec[K[i]]){ if(matched[it])continue; if((b[it]-K[i])<mini){ mini=b[it]-K[i]; idx=it; } } if(mini==(int)(1e9))return 0; matched[idx]=1; } } 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...