Submission #1052827

#TimeUsernameProblemLanguageResultExecution timeMemory
1052827juicyMemory 2 (JOI16_memory2)C++17
0 / 100
1 ms600 KiB
#include "Memory2_lib.h" #include <bits/stdc++.h> using namespace std; void Solve(int T, int N){ vector<int> cands = {0, 1}, res(2 * N); vector his(2 * N, vector<int>(2 * N, -1)); auto flip = [&](int i, int j) { if (his[i][j] != -1) { return his[i][j]; } return his[i][j] = his[j][i] = Flip(i, j); }; auto extract = [&]() { for (int i = 0; i < 3; ++i) { int x = flip(cands[i], cands[i == 0]); bool flg = 1; for (int j = 0; j < 3; ++j) { if (i ^ j) { flg &= x == flip(cands[i], cands[j]); } } if (flg) { res[cands[i]] = x; swap(cands[i], cands.back()); break; } } cands.pop_back(); }; for (int i = 2; i < 2 * N; ++i) { cands.push_back(i); extract(); } res[cands[0]] = res[cands[1]] = flip(cands[0], cands[1]); for (int i = 0; i < 2 * N; ++i) { for (int j = i + 1; j < 2 * N; ++j) { if (res[i] == res[j]) { Answer(i, j, res[i]); } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...