# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
150788 | 준표야 함수컵은 캐리해줄거지? (#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;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
long long SendInfo(std::vector<int> W, std::vector<int> C) {
int N = W.size();
vector<pii> ws, cs;
for(int i=0;i<N;i++) {
cs.push_back({C[i], i});
}
sort(cs.begin(), cs.end());
for(int i=0;i<N;i++) {
ws.push_back({W[i], i});
}
sort(ws.begin(), ws.end());
int *ans = new int[1 << 17];
int wi=0;
int ci=0;
for(;wi<N && ci<N;) {
while(ci<N && ws[wi].first>cs[ci].first) {
ci++;
}
if(ci==N) break;
ans[ws[wi].second] = cs[ci].second;
wi++; ci++;
}
for(int i=wi;i<N;i++)
ans[ws[i].second] = -1;
return ((unsigned long long)ans % (1ll << 24)) >> 8;
}
#include "vassal.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int last, *ans;
void Init(long long B, std::vector<int> C){
int N = C.size();
ans = new int[1 << 17];
int *past = (int*)(((ull)ans >> 24) << 24) ^ (B << 8);
for(int i = 0, im = (1 << 17); i < im; i++)
ans[i] = past[i];
}
int Maid(int W){
return ans[last++];
}