답안 #364139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
364139 2021-02-08T09:50:34 Z yasseenkamel CONSUL (info1cup19_consul) C++14
85 / 100
37 ms 620 KB
#include <bits/stdc++.h>
#include "grader.h"
//#include "grader.cpp"

using namespace std;

map<int,int> vis;

void solve(int n){
    int a[1005];
    for(int i = 0 ; i < 30 ; i ++){
        int idx = (rand() % n) + 1;
        int x = kth(idx);
        if(!vis[x]){
            int y = cnt(x);
            if(y > n / 3){
                say_answer(x);
                return;
            }
        }
    }
    //sort(a,a + n);
    //int cnt = 1;
    say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:10:9: warning: unused variable 'a' [-Wunused-variable]
   10 |     int a[1005];
      |         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 364 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 364 KB Output is correct
2 Correct 9 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 520 KB Output is correct
2 Correct 32 ms 492 KB Output is correct
3 Correct 6 ms 364 KB Output is correct
4 Correct 8 ms 364 KB Output is correct
5 Correct 21 ms 364 KB Output is correct
6 Correct 20 ms 364 KB Output is correct
7 Correct 25 ms 492 KB Output is correct
8 Correct 35 ms 620 KB Output is correct
9 Correct 33 ms 364 KB Output is correct
10 Correct 14 ms 504 KB Output is correct
11 Correct 27 ms 364 KB Output is correct
12 Correct 18 ms 364 KB Output is correct
13 Correct 37 ms 512 KB Output is correct
14 Correct 29 ms 364 KB Output is correct