#include <bits/stdc++.h>
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
std::multiset<int> CC(C.begin(),C.end());
std::sort(W.begin(),W.end());
std::sort(C.begin(),C.end());
long long t=0;
for(int i=0;i<N;i++) {
auto it=CC.lower_bound(W[i]);
if(it!=CC.end())
{
t++;
CC.erase(it);
}
}
while(t>0 && C[t]==C[t-1])t--;
return t;
}
#include <bits/stdc++.h>
long long BB;
int N;
std::set<std::pair<int,int>> S;
std::vector<int> CC;
void Init(long long B, std::vector<int> C){
N = C.size();
BB = B;
CC=C;
std::sort(CC.begin(),CC.end());
for(int i=0;i<N;i++) S.insert({C[i],i});
}
int Maid(int W){
int ret;
auto it=S.lower_bound(std::make_pair(W,-1));
if(BB<N && W>CC[BB] || it==S.end()) return -1;
ret=it->second;
S.erase(it);
return ret;
}
Compilation message
vassal.cpp: In function 'int Maid(int)':
vassal.cpp:19:10: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if(BB<N && W>CC[BB] || it==S.end()) return -1;
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1044 KB |
Correct |
2 |
Correct |
10 ms |
1032 KB |
Correct |
3 |
Correct |
10 ms |
536 KB |
Correct |
4 |
Correct |
10 ms |
1040 KB |
Correct |
5 |
Incorrect |
10 ms |
532 KB |
Wrong |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
74 ms |
8444 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
89 ms |
8576 KB |
B = 50991 |
2 |
Partially correct |
164 ms |
14412 KB |
B = 91406 |
3 |
Incorrect |
173 ms |
15608 KB |
Wrong |
4 |
Halted |
0 ms |
0 KB |
- |