Submission #148547

#TimeUsernameProblemLanguageResultExecution timeMemory
148547TLEWA맞 (#200)King of Chairs (FXCUP4_chairs)C++17
0 / 100
63 ms4500 KiB
#include "king.h" #include <bits/stdc++.h> #define F first #define S second #define pb push_back using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; int n; vector<int> tw, tc; LL SendInfo(vector<int> w, vector<int> c){ n=w.size(); tw=w; tc=c; sort(tw.begin(), tw.end()); sort(tc.begin(), tc.end()); int p=n-1; LL num=0; for(int i=n-1; i>=0; i--){ for(; p>=0; p--){ if(c[i]>=w[i]){ num++; p--; break; } } } return num; }
#include "vassal.h" #include <bits/stdc++.h> #define F first #define S second #define pb push_back using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; int BB; int N; vector<pair<int, int> > Tc; set<pair<int, int> > s; void Init(long long B, std::vector<int> C){ N = C.size(); BB = (int)B; for(int i=0; i<N; i++){ Tc.pb({C[i], i}); } sort(Tc.begin(), Tc.end()); for(int i=N-BB; i<N; i++){ s.insert(Tc[i]); } } int Maid(int W){ set<pair<int, int> >::iterator it; it=s.lower_bound(make_pair(W, -987654321)); if(it==s.end())return -1; int ret=it->second; s.erase(it); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...