Submission #148964

#TimeUsernameProblemLanguageResultExecution timeMemory
148964=SUM(D1:D9) (#200)King of Chairs (FXCUP4_chairs)C++17
0 / 100
73 ms7100 KiB
#include "king.h" #include <algorithm> long long SendInfo(std::vector<int> W, std::vector<int> C) { int N = W.size(); std::sort(W.begin(),W.end()); std::sort(C.begin(),C.end()); int min = 0, max = N; int ans = 0; while(min<=max) { int h = (min+max)/2; for(int i=1;i<=h;i++) if(W[i]>C[N+i-h]) goto u; ans = h; min = h+1; continue; u:; max = h-1; } if(ans==0) return 0; else return W[ans-1]; }
#include "vassal.h" #include <algorithm> #include <map> std::multimap<long long int,int> M; long long limit; int check[100010]; int next[100010],size[100010]; bool cmp(std::pair<int,int> A, std::pair<int,int> B) { return A.first<B.first; } void Init(long long B, std::vector<int> C){ int N = C.size(); limit = B; for(int i=0;i<N;i++) M.insert(std::make_pair(C[i],i)); for(int i=0;i<N;i++) size[i] = 1, next[i] = i; } int Maid(int W){ if(W>limit) return -1; else { std::map<long long int,int> ::iterator it; it = M.lower_bound(W); if(it==M.end()) return -1; else { int ans = it->second; M.erase(it); return ans; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...