Submission #401076

#TimeUsernameProblemLanguageResultExecution timeMemory
401076dolphingarlicMouse (info1cup19_mouse)C++14
35.33 / 100
190 ms204 KiB
#include "grader.h" #include <bits/stdc++.h> typedef long long ll; using namespace std; void solve(int N) { vector<int> perm(N); iota(perm.begin(), perm.end(), 1); vector<bool> known(N, false); int prv = -1; for (int i = 0; i < N;) { if (known[i]) { i++; continue; } int baseline = query(perm); if (baseline == N) return; int found = -1; for (int j = i + 1; j < N; j++) if (!known[j]) { swap(perm[i], perm[j]); int pot = query(perm); if (pot == N) return; if (pot > baseline) { found = j; break; } swap(perm[i], perm[j]); } if (~found) { if (~prv) known[prv] = true; prv = found; } else { known[i] = true; i++; prv = -1; } } query(perm); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...