# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
111970 | 2019-05-17T03:01:13 Z | lauzm0 | None (JOI16_memory2) | C++14 | 0 ms | 0 KB |
#include <iostream> #include<vector> #include<cmath> using namespace std; int main(){ int n; cin >> n; vector<int>pp(2 * n); vector<int>rp; vector<vector<int>>flip1(2*n); for (int i = 0; i < 2*n; i++) { vector<int>p(n + 1, 0); for (int j = 0; j < 2*n; j++) { if (i != j) { p[flip(i,j)]++; flip1[i].push_back(flip(i,j)); } } for (int j = 0; j < n; j++) { if (p[j] % 2 == 1) { pp[p[j]] = j; } } } for (int i = 2 * n - 1; i > 0; i = i - 2) { rp.push_back(pp[i]); } int m = n - 1; int jk = 1; vector<int>a(2 * n); int counter = 2; bool cg = true; while (cg) { for (int i = 0; i < 2 * n; i++) { int count = 0; for (int j = 0; j < flip1[i].size(); j++) { if (flip1[i][j] == rp[m]) { count++; } } if (count == jk) { a[i] = rp[m]; counter--; if (counter == 0) { jk = jk + 2; m--; counter = 2; } if (m < 0) { break; } } } if (m < 0) { cg = false; } } for (int i = 0; i < a.size(); i++) { cout << a[i] << " "; } }