#include "king.h"
#include <bits/stdc++.h>
long long SendInfo(std::vector<int> W, std::vector<int> C)
{
int N = W.size();
sort(C.begin(),C.end());
sort(W.begin(),W.end());
std::vector <bool> able(N, false);
std::vector <bool> FC(N, false);
long long maxweight = 0;
long long maxchair = -1;
for (int i = 0; i<N; i++)
{
int u = std::lower_bound(C.begin(),C.end(),W[i])-C.begin();
while(u < N && FC[u])
{
u++;
}
if (u == N)
{
continue;
}
else
{
FC[u] = 1;
maxweight = std::max(maxweight,(long long)W[i]);
maxchair = std::max(maxchair, (long long)u);
}
}
return maxchair;
}
#include "vassal.h"
#include <algorithm>
long long BB;
std::vector <int> Chairs;
bool fullchair[101010];
void Init(long long B, std::vector<int> C)
{
int N = C.size();
Chairs = C;
sort(Chairs.begin(),Chairs.end());
BB = Chairs[B];
}
int Maid(int W)
{
if (W > BB)
return -1;
int N = Chairs.size();
int u = std::lower_bound(Chairs.begin(),Chairs.end(),W)-Chairs.begin();
while(u < N && fullchair[u])
{
u++;
}
if (u == N)
{
return -1;
}
else
{
fullchair[u] = 1;
return u;
}
}
Compilation message
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:8:6: warning: unused variable 'N' [-Wunused-variable]
int N = C.size();
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1048 KB |
Correct |
2 |
Correct |
10 ms |
1040 KB |
Correct |
3 |
Correct |
10 ms |
1044 KB |
Correct |
4 |
Correct |
10 ms |
1044 KB |
Correct |
5 |
Correct |
10 ms |
1044 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
3684 KB |
Correct |
2 |
Correct |
147 ms |
5768 KB |
Correct |
3 |
Correct |
501 ms |
6180 KB |
Correct |
4 |
Correct |
134 ms |
6184 KB |
Correct |
5 |
Correct |
149 ms |
6100 KB |
Correct |
6 |
Correct |
152 ms |
6188 KB |
Correct |
7 |
Correct |
504 ms |
6184 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
82 ms |
3684 KB |
B = 51294 |
2 |
Partially correct |
160 ms |
5772 KB |
B = 91757 |
3 |
Partially correct |
533 ms |
6184 KB |
B = 99999 |
4 |
Partially correct |
166 ms |
6180 KB |
B = 99999 |
5 |
Partially correct |
196 ms |
6188 KB |
B = 99999 |
6 |
Partially correct |
145 ms |
5932 KB |
B = 99999 |
7 |
Partially correct |
542 ms |
6192 KB |
B = 99999 |
8 |
Runtime error |
75 ms |
4816 KB |
Execution failed because the return code was nonzero |