#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
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 time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
532 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
36 ms |
2752 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
40 ms |
3008 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |