Submission #149958

# Submission time Handle Problem Language Result Execution time Memory
149958 2019-09-01T07:27:43 Z Aliensoft(#3636, computerbox) King of Chairs (FXCUP4_chairs) C++17
0 / 100
51 ms 3008 KB
#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;
      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];
      }
      B/=10;
    }
}

Compilation message

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:52:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Runtime error 10 ms 1040 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 34 ms 3008 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 51 ms 3008 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -