Submission #523469

# Submission time Handle Problem Language Result Execution time Memory
523469 2022-02-07T17:18:20 Z Farhan_HY CONSUL (info1cup19_consul) C++14
100 / 100
30 ms 292 KB
#include<bits/stdc++.h>
#include "grader.h"

using namespace std;

map<int, bool> mp;
bool vis[1001];

void solve(int n)
{
    mp.clear();
    for(int i = 1; i <= n; i++)
        vis[i] = 0;
    srand(0);
    int q = 59;
    bool ok = false;
    while(q-- > 0)
    {
        int i = rand() % n + 1;
        if (vis[i])
            continue;
        vis[i] = 1;
        int x = kth(i);
        if(mp[x])
            continue;
        q--;
        mp[x] = 1;
        int Count = cnt(x);
        if (Count > n / 3)
        {
            ok = true;
            say_answer(x);
            break;
        }
    }
    if (!ok)
        say_answer(-1);
    /// insert your code
}
# Verdict Execution time Memory Grader output
1 Correct 11 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 200 KB Output is correct
2 Correct 4 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 200 KB Output is correct
2 Correct 25 ms 200 KB Output is correct
3 Correct 10 ms 200 KB Output is correct
4 Correct 3 ms 264 KB Output is correct
5 Correct 21 ms 284 KB Output is correct
6 Correct 29 ms 200 KB Output is correct
7 Correct 17 ms 284 KB Output is correct
8 Correct 22 ms 292 KB Output is correct
9 Correct 21 ms 292 KB Output is correct
10 Correct 30 ms 268 KB Output is correct
11 Correct 17 ms 200 KB Output is correct
12 Correct 18 ms 284 KB Output is correct
13 Correct 27 ms 200 KB Output is correct
14 Correct 17 ms 288 KB Output is correct