Submission #209651

#TimeUsernameProblemLanguageResultExecution timeMemory
209651EntityITMemory 2 (JOI16_memory2)C++14
60 / 100
5 ms376 KiB
#include "Memory2_lib.h" #include<bits/stdc++.h> using namespace std; #define all(x) (x).begin(), (x).end() #define sz(x) ( (int)(x).size() ) using LL = long long; mt19937 rng( (uint32_t)chrono::steady_clock::now().time_since_epoch().count() ); void Solve(int T, int N){ vector<int> a(N << 1, -1); vector<int> rem(N << 1); iota(all(rem), 0); while (sz(rem) > 1) { int chosen = rem[rng() % sz(rem)]; for (const auto &i : rem) if (i ^ chosen) a[i] = Flip(chosen, i); a[chosen] = *max_element(all(a) ); vector<int> nRem; for (const auto &i : rem) if (i ^ chosen && a[i] == a[chosen]) nRem.emplace_back(i); rem.swap(nRem); } for (int i = 0; i < N; ++i) { int x = (int)(find(all(a), i) - a.begin() ), y = (int)(find( (x + 1) + all(a), i) - a.begin() ); Answer(x, y, i); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...