#include "king.h"
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
/*
long long ret = 0;
vector<pair<int,int>> C_;
for(const auto &i : C) {
C_.emplace_back(i, 0);
}
for(const auto& w : W) {
auto it = upper_bound(C_.begin(), C_.end(), pair<int,int>(w,0));
if (it == C_.begin()) continue;
it--;
if ((it->first) >= w && (it->second) == 0) {
it->second = 1;
ret++;
}
}*/
return 0LL;
}
#include "vassal.h"
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
vector<pair<int,int>> C_rev;
vector<pair<int,int>> C_;
void Init(long long B, std::vector<int> C){
for(int i = 0 ; i < (int)C.size(); i++) {
C_rev.emplace_back(C[i], i);
C_.emplace_back(C[i], 0);
}
sort(C_.begin(), C_.end());
sort(C_rev.begin(), C_rev.end());
}
int Maid(int W){
auto it = upper_bound(C_.begin(), C_.end(), pair<int,int>(W,0));
if (it == C_.end())
it--;
if(it!=C_.begin()){
auto itt = it;
itt--;
if((itt->first) >= W && (itt->second)== 0) {
it--;
}
}
if ((it->first) >= W && (it->second) == 0) {
int i = it-C_.begin();
it->second = 1;
return (C_rev[i].second);
}
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
1052 KB |
Correct |
2 |
Incorrect |
10 ms |
1060 KB |
Wrong |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
53 ms |
4548 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
64 ms |
4544 KB |
Wrong |
2 |
Halted |
0 ms |
0 KB |
- |