제출 #762881

#제출 시각아이디문제언어결과실행 시간메모리
762881TrunktyCONSUL (info1cup19_consul)C++14
100 / 100
50 ms208 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; //#define int ll #include "grader.h" map<int,int> mp; bool vis[1005]; void solve(int n){ for(int i=1;i<=n;i++){ vis[i] = false; } mp.clear(); srand(314); if(n<=50){ for(int i=1;i<=n;i++){ mp[kth(i)]++; } for(pair<int,int> i:mp){ if(i.second>n/3){ say_answer(i.first); return; } } say_answer(-1); return; } for(int i=1;i<=50;i++){ int curr = rand()%n+1; while(vis[curr]){ curr = rand()%n+1; } vis[curr] = true; mp[kth(curr)]++; } vector<vector<int>> v; for(pair<int,int> i:mp){ v.push_back({i.second,i.first}); } sort(v.begin(),v.end(),greater<vector<int>>()); int vs = v.size(); for(int i=0;i<min(vs,10);i++){ if(cnt(v[i][1])>n/3){ say_answer(v[i][1]); return; } } say_answer(-1); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...