#include "king.h"
#include <algorithm>
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
std::sort(W.begin(),W.end());
std::sort(C.begin(),C.end());
int min = 0, max = N;
int ans = 0;
while(min<=max)
{
int h = (min+max)/2;
for(int i=1;i<=h;i++) if(W[i]>C[N+i-h]) goto u;
ans = h;
min = h+1;
continue;
u:;
max = h-1;
}
if(ans==0) return 0;
else return W[ans-1];
}
#include "vassal.h"
#include <algorithm>
#include <map>
std::multimap<long long int,int> M;
long long limit;
int check[100010];
int next[100010],size[100010];
bool cmp(std::pair<int,int> A, std::pair<int,int> B)
{
return A.first<B.first;
}
void Init(long long B, std::vector<int> C){
int N = C.size();
limit = B;
for(int i=0;i<N;i++) M.insert(std::make_pair(C[i],i));
for(int i=0;i<N;i++) size[i] = 1, next[i] = i;
}
int Maid(int W){
if(W>limit) return -1;
else
{
std::map<long long int,int> ::iterator it;
it = M.lower_bound(W);
if(it==M.end()) return -1;
else
{
int ans = it->second;
M.erase(it);
return ans;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1060 KB |
Correct |
2 |
Incorrect |
11 ms |
1060 KB |
Wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
65 ms |
7100 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
73 ms |
7100 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |