Submission #364105

#TimeUsernameProblemLanguageResultExecution timeMemory
364105sobaCONSUL (info1cup19_consul)C++14
19 / 100
804 ms364 KiB
#include <bits/stdc++.h> #include "grader.h" //#include "grader.cpp" using namespace std; void solve(int n) { int need=(n)/3; vector<int>v; for(int i=1; i <= n ; i++) { v.push_back(kth(i)); } sort(v.begin(), v.end()); int cn=1 , ans=-1; for(int i = 1 ; i<n ; i++) { if(v[i]==v[i-1])cn++; else { if( cn>need) { ans=v[i-1]; cn=1; break; } cn=1; } } if( cn > need) { ans=v[n-1]; } say_answer(ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...