Submission #364119

# Submission time Handle Problem Language Result Execution time Memory
364119 2021-02-08T09:09:03 Z yasseenkamel CONSUL (info1cup19_consul) C++14
19 / 100
924 ms 364 KB
#include <bits/stdc++.h>
#include "grader.h"
//#include "grader.cpp"

using namespace std;

void solve(int n){
    int a[1005];
    for(int i = 0 ; i < n ; i ++){
        int x = kth(i + 1);
        a[i] = x;
    }
    sort(a,a + n);
    int cnt = 1;
    for(int i = 1 ; i < n ; i ++){
        if(a[i] != a[i - 1]){
            if(cnt > n / 3){
                say_answer(a[i - 1]);
                //cout << a[i - 1] << endl;
                return;
            }
            cnt = 0;
        }
        cnt ++;
        //cout << a[i] << " " << cnt << endl;
    }
    if(cnt > n / 3){
        say_answer(a[n - 1]);
        return;
    }
    say_answer(-1);
}
# Verdict Execution time Memory Grader output
1 Correct 47 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 49 ms 364 KB Output is partially correct
2 Partially correct 81 ms 364 KB Output is partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 924 ms 364 KB Output is partially correct
2 Halted 0 ms 0 KB -