| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 149959 | 서울대학교 연구공원 944동 삼성전자서울대연구소 (#200) | Wine Tasting (FXCUP4_wine) | C++17 | 15 ms | 1064 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 "bartender.h"
#include<bits/stdc++.h>
using namespace std;
static vector<int> shuf;
static void Init(int N)
{
	mt19937_64 rng(573);
	for(int i=0; i<N; ++i)
		shuf.push_back(rng()%(N-i));
}
static void Shuffle(vector<int>& R)
{
	int N = R.size();
	Init(N);
	for(int i=0; i<N; ++i)
		swap(R[N-1-i],R[shuf[i]]);
}
static void DeShuffle(vector<int>& R)
{
	int N = R.size();
	Init(N);
	for(int i=N-1; i>=0; --i)
		swap(R[N-1-i],R[shuf[i]]);
}
std::vector<int> BlendWines(int K, std::vector<int> R){
	int N = R.size();
	Shuffle(R);
	vector<int> ret(N);
	int cur = 1;
	for(int step=1;;++step)
	{
		for(int i=0; i<N; ++i)
		{
			if(cur == R[i])
			{
				ret[i] = step;
				++cur;
			}
		}
		if(cur==N+1) break;
	}
	return ret;
}
#include "taster.h"
#include<bits/stdc++.h>
using namespace std;
static vector<int> shuf;
static void Init(int N)
{
	mt19937_64 rng(573);
	for(int i=0; i<N; ++i)
		shuf.push_back(rng()%(N-i));
}
static void Shuffle(vector<int>& R)
{
	int N = R.size();
	Init(N);
	for(int i=0; i<N; ++i)
		swap(R[N-1-i],R[shuf[i]]);
}
static void DeShuffle(vector<int>& R)
{
	int N = R.size();
	Init(N);
	for(int i=N-1; i>=0; --i)
		swap(R[N-1-i],R[shuf[i]]);
}
std::vector<int> SortWines(int K, std::vector<int> A) {
	int N = A.size();
	vector<int> R(N);
	int ans = 1;
	for(int i=0; i<K; ++i)
	{
		for(int j=0; j<N; ++j)
			if(A[j] == i)
			{
				R[j] = ans++;
			}
	}
	DeShuffle(R);
	return R;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
