# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149959 | 서울대학교 연구공원 944동 삼성전자서울대연구소 (#200) | 포도주 시음 (FXCUP4_wine) | C++17 | 15 ms | 1064 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |