제출 #872828

#제출 시각아이디문제언어결과실행 시간메모리
872828rainboyShuffle (NOI19_shuffle)C++17
12 / 100
1 ms1372 KiB
#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); for (int d = 0; d < b; d++) iii[d].clear(); for (int i = 0; i < n; i++) iii[xx[i] / pp[h] % b].push_back(i + 1); vvi aaa = shuffle(iii); for (int d = 0; d < b; d++) for (int g = 0; g < k; g++) xx_[aaa[d][g] - 1] += d * pp[h]; } for (int a = 0; a < n; a++) aa[idx[xx_[a]]] = a + 1; } return aa; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...