#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]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
10 ms |
1040 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
34 ms |
3008 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
51 ms |
3008 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |