# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
530139 | LucaDantas | CONSUL (info1cup19_consul) | C++17 | 39 ms | 304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 1e5+10, SZ = 50;
mt19937 rng(random_device{}());
int rnd(int x) { return (rng() % x + x) % x; }
int a[maxn], mark[maxn];
void solve(int n)
{
vector<int> usar;
map<int,int> freq;
while(usar.size() < min(n, SZ)) {
int rd = rnd(n)+1;
if(!mark[rd])
usar.push_back(rd), a[rd] = kth(rd), freq[a[rd]]++;
mark[rd] = 1;
}
for(int x : usar)
mark[x] = 0;
vector<pair<int,int>> maiores;
for(auto it : freq)
maiores.push_back({it.second, it.first});
sort(maiores.begin(), maiores.end(), greater<pair<int,int>>());
while(maiores.size() > 60 - SZ)
maiores.pop_back();
if(n <= 50) {
if(maiores[0].first > n/3) say_answer(maiores[0].second);
else say_answer(-1);
return;
}
for(int i = 0; i < maiores.size(); i++)
if(cnt(maiores[i].second) > n/3) return (void)(say_answer(maiores[i].first));
say_answer(-1);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |