Submission #149999

#TimeUsernameProblemLanguageResultExecution timeMemory
149999Aliensoft (#200)King of Chairs (FXCUP4_chairs)C++17
0 / 100
40 ms3008 KiB
#include "king.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long SendInfo(vector<int> W,vector<int> C) { int N = W.size(); ll cis=0; sort(W.begin(),W.end()); reverse(W.begin(),W.end()); for(ll i=0;i<N;i++) { cis=cis*10+W[i]; } return cis; }
#include "vassal.h" #include <bits/stdc++.h> #define ll long long using namespace std; ll answer[200010]; ll used[200010]; long long cp; void Init(long long B,vector<int> C) { int N = C.size(); multiset<pair<ll,ll> >nuj; for(ll i=0;i<(ll)C.size();i++) { nuj.insert(make_pair(C[i],i)); } cp=B; ll cnt=0; while(B>0) { ll q=B%10; ll ans=0; auto id=nuj.lower_bound(make_pair(q,0)); if(id!=nuj.end()) { ans=(*id).second; nuj.erase(id); } else ans=-1; answer[cnt]=ans; cnt++; B/=10; } } int Maid(int W) { long long B=cp; ll cnt=0; while(B>0) { ll q=B%10; if(!used[cnt] && q==W) { used[cnt]=1; return answer[cnt]; } cnt++; B/=10; } }

Compilation message (stderr)

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:13:6: warning: unused variable 'N' [-Wunused-variable]
  int N = C.size();
      ^
vassal.cpp: In function 'int Maid(int)':
vassal.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...