Submission #1146648

#TimeUsernameProblemLanguageResultExecution timeMemory
1146648Dan4LifeCONSUL (info1cup19_consul)C++20
100 / 100
7 ms428 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; #define sz(a) (int)s.size() #define all(a) begin(a),end(a) using vi = vector<int>; int a[10000]; map<int,int> M; int q; int getEle(int i){ if(!q) return -1; if(a[i]!=-1) return a[i]; q--; return a[i]=kth(i); } int getCnt(int a){ if(!q) return 0; if(M.find(a)!=end(M)) return M[a]; q--; return M[a]=cnt(a); } void solve(int n){ srand(time(0)); M.clear(); q = 50; for(int i = 1; i <= n; i++) a[i]=-1; vi v(n,0); iota(all(v),1); random_shuffle(all(v)); for(auto i : v){ int x = getEle(i); if(x==-1 or !q) break; if(getCnt(x) > n/3){ say_answer(x); return; } } say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...