# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148839 | 본인 방금 올솔하는 상상함 (#200) | King of Chairs (FXCUP4_chairs) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "king.h"
#include<algorithm>
using namespace std;
long long SendInfo(vector<int> W, vector<int> C) {
int N = W.size();
sort(W.begin(), W.end());
sort(C.begin(), C.end());
int j=0,cnt=0,bef=-1;
long long ret=0;
for(int i=0;i<N;i++){
while(j<C.size()&&W[i]>C[j]) j++;
if(j<C.size()) {
if(bef!=W[i]) cnt=1;
else cnt++;
ret=(W[i]<<20)+cnt;
bec = W[i];
}
else break;
}
return ret;
}
#include "vassal.h"
#include <bits/stdc++.h>
using namespace std;
long long Wmax, nmax;
set<pair<int,int>> se;
int N,cnt;
void Init(long long B, vector<int> C){
N = C.size();
for(int i=0;i<N;i++){
se.insert(make_pair(C[i],i));
}
nmax = B&((1<<20)-1);
Wmax = B>>20;
}
int Maid(int W){
if(W<Wmax){
auto it = se.lower_bound(make_pair(W,0));
int ret = it->second;
se.erase(it);
return ret;
}
if(W==Wmax){
if(cnt>=nmax) return -1;
cnt++;
auto it = se.lower_bound(make_pair(W,0));
int ret = it->second;
se.erase(it);
return ret;
}
return -1;
}