#include "king.h"
#include <bits/stdc++.h>
using namespace std;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
sort(W.begin(), W.end()); reverse(W.begin(), W.end());
sort(C.begin(), C.end()); reverse(C.begin(), C.end());
int l = 0, r = N-1;
while(l <= r) {
int m = l+r >> 1;
bool f = 1;
for(int i=0; i<=m; i++) if(C[i] < W[i]) f = 0;
if(f) l = m+1;
else r = m-1;
}
return W[l-1];
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
long long BB;
set<pii> st;
int c = 0;
void Init(long long B, std::vector<int> C){
int N = C.size();
BB = B;
for(int i=0; i<N; i++) st.insert({C[i], i});
}
int Maid(int W) {
if(1LL*W > BB) return -1;
auto it = st.lower_bound({W, -1});
if(it == st.end()) return -1;
st.erase(it);
return (*it).second;
}
Compilation message
king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:11:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int m = l+r >> 1;
~^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1048 KB |
Correct |
2 |
Incorrect |
11 ms |
1048 KB |
Wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
5940 KB |
Correct |
2 |
Incorrect |
98 ms |
9608 KB |
Wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
5936 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |