#include "king.h"
#include <bits/stdc++.h>
using namespace std;
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());
int cidx = n-1;
long long ans = 0;
for(int i=n-1;i>=0;i--) {
if(C[cidx] >= W[i]) {
cidx--;
ans++;
}
}
return ans;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
int sz;
vector<pair<int,int>> C;
set<pair<int,int>> S;
void Init(long long B, std::vector<int> C2){
for(int i=0;i<C2.size();i++) {
C.push_back(pair<int,int>(C2[i],i));
}
sz = B;
sort(C.begin(), C.end());
for(int i=C.size()-1;i>=C.size()-sz;i--) {
S.insert(C[i]);
}
//cout<<sz;
// ToDo
}
int Maid(int W){
set<pair<int,int>>::iterator it = S.lower_bound(pair<int,int>(W,-1));
if(it == S.end()) {
return -1;
}
S.erase(it);
//cout<<W<<' '<<(*it).second<<'\n';
return (*it).second;
}
Compilation message
vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:9:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<C2.size();i++) {
~^~~~~~~~~~
vassal.cpp:15:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=C.size()-1;i>=C.size()-sz;i--) {
~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
5932 KB |
Correct |
2 |
Correct |
104 ms |
11448 KB |
Correct |
3 |
Correct |
93 ms |
9964 KB |
Correct |
4 |
Correct |
116 ms |
12312 KB |
Correct |
5 |
Correct |
117 ms |
12244 KB |
Correct |
6 |
Correct |
114 ms |
12388 KB |
Correct |
7 |
Correct |
94 ms |
9964 KB |
Correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
77 ms |
5960 KB |
B = 50991 |
2 |
Partially correct |
151 ms |
11232 KB |
B = 91406 |
3 |
Partially correct |
119 ms |
10036 KB |
B = 49847 |
4 |
Partially correct |
165 ms |
12424 KB |
B = 99850 |
5 |
Partially correct |
165 ms |
12272 KB |
B = 99598 |
6 |
Partially correct |
165 ms |
12276 KB |
B = 99746 |
7 |
Partially correct |
115 ms |
10100 KB |
B = 49910 |
8 |
Correct |
89 ms |
7992 KB |
Correct |