#include "king.h"
#include<map>
#include<vector>
#include<algorithm>
#include<iostream>
#define ll long long
#define rep(i,a,b) for(int i = a;i < b;i++)
#define MAXN 300003
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int n = W.size();
int cur = 0;
sort(W.rbegin(),W.rend());
sort(C.rbegin(),C.rend());
rep(i,0,n)
{
if(W[i] <= C[cur])
{
cur++;
}
}
return n-cur;
}
#include "vassal.h"
#include<map>
#include<vector>
#include<iostream>
#include<set>
#define ll long long
#define pi pair < ll,ll >
#define mp(a,b) make_pair(a,b)
#define rep(i,a,b) for(int i = a;i < b;i++)
#define MAXN 1000003
#define INF 1e13
using namespace std;
long long maxi;
set < pi > available;
ll seg[4*MAXN];
void update(ll low,ll high,ll pos,ll slow)
{
if(low == high && low == slow)
{
seg[pos]++;
return;
}
if(low > slow || high < slow)
return;
ll mid = (low+high)/2;
update(low,mid,pos*2+1,slow);
update(mid+1,high,pos*2+2,slow);
seg[pos] = seg[pos*2+1]+seg[pos*2+2];
return;
}
ll query(ll low,ll high,ll pos,ll val)
{
ll mid = (low+high)/2;
if(low == high)
return low;
if(seg[pos*2+1] >= val)
return query(low,mid,pos*2+1,val);
else
return query(mid+1,high,pos*2+2,val-seg[pos*2+1]);
}
void Init(long long B, std::vector<int> C){
int n = C.size();
maxi = (B==n) ? INF : C[B];
rep(i,0,n)
{
available.insert(mp(C[i],i));
update(0,MAXN-1,0,C[i]);
}
return;
}
int Maid(int W){
if(W>maxi)
return -1;
else
{
set < pi >::iterator it = available.lower_bound(mp(W,0));
available.erase(it);
return (*it).second;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1172 KB |
Correct |
2 |
Incorrect |
10 ms |
788 KB |
Wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
87 ms |
22932 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
90 ms |
23080 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |