# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
872827 | rainboy | Shuffle (NOI19_shuffle) | C11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "shuffle.h"
#include <vector>
using namespace std;
const int N = 1000, L = 10; /* L = ceil(log2(N)) */
typedef vector<int> vi;
typedef vector<vi> vvi;
int pp[L];
vi solve(int n, int b, int k, int q, int s) {
vi aa(n);
if (s == 3) {
int l = 0, p = 1;
while (p < n)
pp[l++] = p, p *= b;
vi xx(n), idx(p);
for (int i = 0; i < n; i++) {
int d = i % b, x = d;
for (int h = 1; h < l; h++) {
int d_ = (i / pp[h] + d) % b;
x += d_ * pp[h];
}
xx[i] = x, idx[x] = i;
}
vi xx_(n, 0);
for (int h = 0; h < l; h++) {
vvi iii(b);