# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1035656 |
2024-07-26T13:01:39 Z |
vjudge1 |
Shuffle (NOI19_shuffle) |
C++17 |
|
19 ms |
604 KB |
#include "shuffle.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
const int N = 6;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> s, ans;
vector<int> solve(int N, int B, int K, int Q, int ST) {
ans.resize(N);
s.resize(N);
for (int i = 0; i < N; i++) {
s[i] = i;
}
vector<vector<int>> a(B, vector<int>(K));
for (int i = 0; i < B; i++) {
for (int j = 0; j < K; j++) {
a[i][j] = i*K + j + 1;
}
}
vector<vector<int>> b = shuffle(a);
while (1) {
shuffle(all(b), rng);
for (int i = 0; i < B; i++) {
shuffle(all(b[i]), rng);
for (int j = 0; j < K; j++) {
ans[i*K + j] = b[i][j];
}
}
// check
bool ok = 1;
for (int dalekofrivialovesesomer = 0; dalekofrivialovesesomer <= 3; dalekofrivialovesesomer++) {
shuffle(all(s), rng);
for (int i = 0; i < B; i++) {
for (int j = 0; j < K; j++) {
a[i][j] = s[i*K + j] + 1;
}
}
vector<vector<int>> c = shuffle(a);
for (int i = 0; i < B; i++) {
for (int j = 0; j < B; j++) {
a[i][j] = ans[a[i][j] - 1];
}
sort(all(a[i]));
}
sort(all(a));
for (int i = 0; i < B; i++) {
sort(all(c[i]));
}
sort(all(c));
if (a != c) {
ok = 0;
break;
}
}
if (!ok) continue;
return ans;
}
return ans;
/*
sort(all(b));
do {
}
while (next_permutation(all(b)));
*/
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Wrong Answer. Used too many queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Wrong Answer. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
Wrong Answer. Used too many queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Wrong Answer. Used too many queries. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
19 ms |
460 KB |
Wrong Answer. Used too many queries. |
2 |
Halted |
0 ms |
0 KB |
- |