Submission #922479

# Submission time Handle Problem Language Result Execution time Memory
922479 2024-02-05T14:45:26 Z maxFedorchuk CONSUL (info1cup19_consul) C++17
85 / 100
11 ms 400 KB
#include "bits/stdc++.h"
#include "grader.h"

using namespace std;
/*
const long long MX=2e5+10;
int v[MX];
int k[MX];
int sz;

int kth(int i)
{
    return v[i];
}

int cnt(int zn)
{
    int rt=0;

    for(int i=1;i<=sz;i++)
    {
        rt+=(v[i]==zn);
    }

    return rt;
}

void say_answer(int a)
{
    cout<<a<<"\n";
    exit(0);
}
*/
void solve(int n)
{
    for(int i=0;i<30;i++)
    {
        int zn=kth(((1ll*(rand()%n+1)*(rand()%n+1))%n+1));
        int kl=cnt(zn);

        if(kl>(n/3))
        {
            say_answer(zn);
            return;
        }
    }

    say_answer(-1);
}
/*
int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    cin>>sz;

    for(int i=1;i<=sz;i++)
    {
        cin>>v[i];
    }

    solve(sz);
    return 0;
}
 */
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 8 ms 400 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 11 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 11 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 10 ms 344 KB Output is correct
8 Correct 10 ms 344 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
11 Correct 10 ms 344 KB Output is correct
12 Correct 8 ms 344 KB Output is correct
13 Correct 10 ms 344 KB Output is correct
14 Correct 11 ms 344 KB Output is correct