Submission #320967

#TimeUsernameProblemLanguageResultExecution timeMemory
320967lohachoMemory 2 (JOI16_memory2)C++14
0 / 100
1 ms512 KiB
#include "Memory2_lib.h" #include <bits/stdc++.h> using namespace std; using LL = long long; void Solve(int T, int N){ N *= 2; int pos[2] = {0, 1}; int pval = Flip(pos[0], pos[1]); for(int i = 2; i < N; ++i){ int val[2] = {Flip(pos[0], i), Flip(pos[1], i)}; if(val[0] == val[1]){ continue; } if(pval == val[0]){ pos[0] = i; pval = val[1]; } else{ pos[1] = i; pval = val[0]; } } int ans[104]; ans[pos[0]] = ans[pos[1]] = pval; for(int i = 0; i < N; ++i){ if(i == pos[0] || i == pos[1]){ continue; } ans[i] = Flip(i, pos[0]); } for(int i = 0; i < N; ++i){ if(ans[i] == -1){ continue; } for(int j = i + 1; j < N; ++j){ if(ans[i] == ans[j]){ Answer(i, j, ans[i]); ans[j] = -1; break; } } } return; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...