제출 #1145885

#제출 시각아이디문제언어결과실행 시간메모리
1145885idonoamCONSUL (info1cup19_consul)C++20
15 / 100
33 ms416 KiB
#include <bits/stdc++.h> #include <cctype> #include "grader.h" using namespace std; void solve(int n) { if( n<= 60){ vector<int> vec(n); for(int i = 0; i < n;i++){ vec[i] = kth(i+1); } sort(vec.begin(), vec.end()); long long ls = vec[0], cou = 1; bool cont = true; for(int i = 1; i < n && cont; i++){ if(ls == vec[i]){ if(++cou > n/3){ say_answer(ls); cont = false; } } else{ ls = vec[i]; cou = 1; } } if(cont){say_answer(-1);} } else{ vector<int> vec(n/2); for(int i = 0; i < n/2;i++){ vec[i] = kth(i*2+1); } sort(vec.begin(), vec.end()); long long ls = vec[0], cou = 1; bool cont = true; for(int i = 1; i < n/2 && cont; i++){ if(ls == vec[i]){ if(++cou > n/6){ if(cnt(ls) > n/3){ say_answer(ls); } else{cou = -n;} cont = false; } } else{ ls = vec[i]; cou = 1; } } if(cont){say_answer(-1);} } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...