Submission #872828

# Submission time Handle Problem Language Result Execution time Memory
872828 2023-11-13T22:28:25 Z rainboy Shuffle (NOI19_shuffle) C++17
12 / 100
1 ms 1372 KB
#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 time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 448 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Wrong Answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Wrong Answer.
2 Halted 0 ms 0 KB -