답안 #409644

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
409644 2021-05-21T09:19:17 Z Atill83 CONSUL (info1cup19_consul) C++14
85 / 100
37 ms 456 KB
#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
int num[60005];

unordered_map<int, int> mp;

void solve(int n)
{
    memset(num, -1, sizeof(num));
    mt19937 rng(time(NULL));
    int q = 60;
    while(q >= 2){
        int idx = rng() % n + 1;
        if(num[idx] == -1){
            q--;
            num[idx] = kth(idx);
        }
        auto u = mp.find(num[idx]);
        int cn;
        if(u == mp.end()){
            cn = cnt(num[idx]);
            q--; 
        }else{
            cn = (*u).second;
        }
        if(cn > n / 3){
            say_answer(num[idx]);
            return;
        }
    }
    
    say_answer(-1);
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 16 ms 456 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 456 KB Output is correct
2 Correct 12 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 456 KB Output is correct
2 Correct 15 ms 456 KB Output is correct
3 Correct 5 ms 456 KB Output is correct
4 Correct 12 ms 456 KB Output is correct
5 Correct 22 ms 456 KB Output is correct
6 Correct 15 ms 456 KB Output is correct
7 Correct 32 ms 456 KB Output is correct
8 Correct 24 ms 456 KB Output is correct
9 Correct 30 ms 456 KB Output is correct
10 Correct 28 ms 456 KB Output is correct
11 Correct 17 ms 456 KB Output is correct
12 Correct 14 ms 456 KB Output is correct
13 Correct 37 ms 456 KB Output is correct
14 Correct 15 ms 456 KB Output is correct