#include "king.h"
#include<algorithm>
#include<iostream>
using namespace std;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
long long upper = 0;
sort(W.begin(), W.end());
sort(C.begin(), C.end());
int cnt = 0;
for (auto i : W) {
while (cnt<N-1 && i > C[cnt]) cnt++;
if (i <= C[cnt]) { upper = i; cnt++; if (cnt >= N) break; }
}
return upper;
}
#include "vassal.h"
#include<algorithm>
#include<iostream>
using namespace std;
long long BB;
std::vector<int>CC;
void Init(long long B, std::vector<int> C){
int N = C.size();
BB = B;
CC= C;
sort(CC.begin(), CC.end());
}
bool v[101010];
int Maid(int W){
if (BB < W) return -1;
int l=0, r=CC.size(), mid;
while (l < r) {
mid = (l +r+1) / 2;
if (CC[mid] < W) l = mid + 1;
else r = mid-1;
}
while (v[l]) l++;
v[l] = 1;
return l;
}
Compilation message
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9:6: warning: unused variable 'N' [-Wunused-variable]
int N = C.size();
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
756 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
47 ms |
3452 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
46 ms |
3412 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |