Submission #757684

#TimeUsernameProblemLanguageResultExecution timeMemory
757684ymmCONSUL (info1cup19_consul)C++17
85 / 100
32 ms208 KiB
#ifdef EVAL #include "grader.h" #endif #include <bits/stdc++.h> #define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x) #define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x) typedef long long ll; typedef std::pair<int, int> pii; typedef std::pair<ll , ll > pll; using namespace std; #ifndef EVAL void solve(int N); int kth(int i) { int x; cout << "v[" << i << "]: "; cin >> x; return x; } int cnt(int x) { int ans; cout << "cnt(" << x << "): "; cin >> ans; return ans; } void say_answer(int a) { cout << "ans: " << a << '\n'; } int main() { int n; cin >> n; solve(n); } #endif void solve(int n) { mt19937_64 rd(time(0)); Loop (_,0,30) { int p = rd()%n; int v = kth(p+1); int c = cnt(v); if (c*3 > n) { say_answer(v); return; } } say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...