Submission #148808

#TimeUsernameProblemLanguageResultExecution timeMemory
148808욱방켜!! (twitch.tv/wookje) (#200)King of Chairs (FXCUP4_chairs)C++17
95 / 100
182 ms15616 KiB
#include "king.h" #include <bits/stdc++.h> long long SendInfo(std::vector<int> W, std::vector<int> C) { int N = W.size(); std::multiset<int> CC(C.begin(),C.end()); std::sort(W.begin(),W.end()); std::sort(C.begin(),C.end()); for(int i=0;i<N;i++) { auto it=CC.lower_bound(W[i]); if(it==CC.end()) { if(i) return lower_bound(C.begin(),C.end(),W[i-1])-C.begin(); return 0; } CC.erase(it); } return N-1; }
#include "vassal.h" #include <bits/stdc++.h> long long BB; int N; std::set<std::pair<int,int>> S; std::vector<int> CC; void Init(long long B, std::vector<int> C){ N = C.size(); BB = B; CC=C; std::sort(CC.begin(),CC.end()); for(int i=0;i<N;i++) S.insert({C[i],i}); } int Maid(int W){ int ret; auto it=S.lower_bound(std::make_pair(W,-1)); if(BB<N && W>CC[BB] || it==S.end()) return -1; ret=it->second; S.erase(it); return ret; }

Compilation message (stderr)

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:20:10: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
  if(BB<N && W>CC[BB] || it==S.end()) return -1;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...