#include "king.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
ll SendInfo(vi W, vi C) {
sort(all(W));
sort(all(C));
int n=C.size();
multiset<int>s;
for(int i=0; i<n; i++)
s.insert(C[i]);
int ans=0;
for(int i=0; i<n; i++){
auto it=s.lower_bound(W[i]);
if(it==s.end())break;
ans=*it;
s.erase(it);
}
return 0;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int>pi;
int mx=0;
multiset<pi>s;
void Init(ll B, vi C){
mx=1e9;
int n=C.size();
for(int i=0; i<n; i++)
s.insert({C[i],i});
}
int Maid(int W){
if(W>mx)return -1;
auto it=s.upper_bound({W,-1});
if(it==s.end())return -1;
int ans=it->second;
s.erase(it);
return ans;
}
Compilation message
king.cpp: In function 'll SendInfo(vi, vi)':
king.cpp:17:9: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
17 | int ans=0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
496 KB |
Correct |
2 |
Correct |
0 ms |
488 KB |
Correct |
3 |
Correct |
0 ms |
512 KB |
Correct |
4 |
Correct |
0 ms |
584 KB |
Correct |
5 |
Correct |
0 ms |
584 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
7852 KB |
Correct |
2 |
Correct |
111 ms |
13584 KB |
Correct |
3 |
Correct |
106 ms |
14832 KB |
Correct |
4 |
Correct |
111 ms |
14772 KB |
Correct |
5 |
Correct |
114 ms |
14624 KB |
Correct |
6 |
Correct |
114 ms |
14616 KB |
Correct |
7 |
Correct |
118 ms |
14728 KB |
Correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
7948 KB |
Correct |
2 |
Correct |
126 ms |
13696 KB |
Correct |
3 |
Correct |
142 ms |
14820 KB |
Correct |
4 |
Correct |
184 ms |
14820 KB |
Correct |
5 |
Correct |
161 ms |
14740 KB |
Correct |
6 |
Correct |
135 ms |
14808 KB |
Correct |
7 |
Correct |
122 ms |
14796 KB |
Correct |
8 |
Correct |
110 ms |
14720 KB |
Correct |