Submission #423486

#TimeUsernameProblemLanguageResultExecution timeMemory
423486milleniumEeeeChameleon's Love (JOI20_chameleon)C++14
0 / 100
30 ms328 KiB
#ifndef EVAL #include "grader.cpp" #endif #include "chameleon.h" #include <bits/stdc++.h> #define fr first #define sc second #define pii pair<int, int> #define pb push_back #define szof(s) (int)s.size() #define all(s) s.begin(), s.end() #define ll long long using namespace std; const int MAXN = 505; // Query(p) | p is vector<int> // Answer(a, b) mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); int get_rand() { ll x = rnd(); x %= (ll)1e9; if (x < 0) { x = -x; } return x; } int gen(int l, int r) { return l + (get_rand() % (r - l + 1)); } int n; bool found[MAXN * 2]; void Solve(int N) { n = N; for (int i = 1; i <= n * 2; i++) { if (found[i]) { continue; } set <int> st; while (1) { int pos = gen(1, n * 2); if (!found[pos] && pos != i && st.find(pos) == st.end()) { vector <int> ask = {i, pos}; st.insert(pos); int res = Query(ask); if (res == 1) { found[i] = found[pos] = 1; Answer(i, pos); break; } } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...