Submission #1035652

#TimeUsernameProblemLanguageResultExecution timeMemory
1035652vjudge1Shuffle (NOI19_shuffle)C++17
Compilation error
0 ms0 KiB
#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; } } 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]; } } vector<vector<int>> c = shuffle(a); for (int j = 0; j < B; j++) { a[i][j] = ans[a[i][j]]; sort(all(a[i])); } sort(all(a)); for (int j = 0; j < B; j++) { 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))); */ }

Compilation message (stderr)

shuffle.cpp: In function 'std::vector<int> solve(int, int, int, int, int)':
shuffle.cpp:16:12: error: 'n' was not declared in this scope
   16 |   s.resize(n);
      |            ^
shuffle.cpp:24:19: error: 'k' was not declared in this scope
   24 |       a[i][j] = i*k + j;
      |                   ^
shuffle.cpp:35:15: error: 'k' was not declared in this scope
   35 |         ans[i*k + j] = b[i][j];
      |               ^
shuffle.cpp:45:25: error: 'k' was not declared in this scope
   45 |           a[i][j] = s[i*k + j];
      |                         ^
shuffle.cpp:52:11: error: 'i' was not declared in this scope
   52 |         a[i][j] = ans[a[i][j]];
      |           ^
shuffle.cpp:58:20: error: 'i' was not declared in this scope
   58 |         sort(all(c[i]));
      |                    ^
shuffle.cpp:5:16: note: in definition of macro 'all'
    5 | #define all(x) x.begin(), x.end()
      |                ^