#include "king.h"
long long SendInfo(std::vector<int> W, std::vector<int> C) {
return 0;
}
#include "vassal.h"
#include <algorithm>
struct data {
int c, pos;
};
bool cmp(const data& a, const data& b) {
return a.c < b.c;
}
int cnt, N, idx;
std::vector<data> C2;
bool check[100001];
void Init(long long B, std::vector<int> C) {
cnt = 0;
N = C.size();
idx = 0;
for (int i=0; i<N; i++) {
C2.push_back({C[i], i});
check[i] = false;
}
std::sort(C2.begin(), C2.end(), cmp);
}
int Maid(int W) {
if (N <= 10) {
for (int i=0; i<N; i++) {
if (check[i] || C2[i].c < W) continue;
check[C2[i].pos] = true;
return C2[i].pos;
}
return -1;
} else {
while (idx < N && C2[idx].c < W) {
idx++;
}
if (idx >= N) {
return -1;
} else {
return C2[idx++].pos;
}
}
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
1052 KB |
Correct |
2 |
Correct |
10 ms |
1060 KB |
Correct |
3 |
Correct |
10 ms |
1060 KB |
Correct |
4 |
Correct |
10 ms |
972 KB |
Correct |
5 |
Correct |
10 ms |
540 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
3904 KB |
Correct |
2 |
Correct |
96 ms |
6524 KB |
Correct |
3 |
Correct |
101 ms |
6732 KB |
Correct |
4 |
Correct |
99 ms |
6984 KB |
Correct |
5 |
Correct |
101 ms |
6988 KB |
Correct |
6 |
Correct |
97 ms |
6988 KB |
Correct |
7 |
Correct |
95 ms |
6984 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
55 ms |
4164 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |