Submission #383245

# Submission time Handle Problem Language Result Execution time Memory
383245 2021-03-29T09:51:47 Z Ahmad_Hasan CONSUL (info1cup19_consul) C++17
85 / 100
31 ms 492 KB
#include<bits/stdc++.h>
#include "grader.h"
/**
     ||||||||||       |||||     |||||    ||||||||||
    |||||||||||||     |||||     |||||  |||||
   ||||     ||||||    |||||     |||||  |||||
  |||||||||||||||||   |||||||||||||||    ||||||||||
 |||||||||||||||||||  |||||||||||||||           |||||
 |||||         |||||  |||||     |||||           |||||
 |||||         |||||  |||||     |||||    ||||||||||
AHMED;HASSAN;SAEED;
*/

using namespace std;

static const int MIN_VALUE = 0, MAX_VALUE = (1e9) - 1;

static map<int,int> mp;
static int Q, N, a[5005];
static bool issol, answer;

void solve(int n){
    vector<int>vis(n);

    for(int i=0;i<min(30,n);i++){
        int ri=rand()%n;
        while(vis[ri]){
            ri=rand()%n;
        }
        vis[ri]=1;

        int ret=kth(ri+1);
        int ret2=cnt(ret);
        if(ret2>((n)/3)){
            say_answer(ret);
            return;
        }


    }
    say_answer(-1);
}

Compilation message

consul.cpp:21:20: warning: 'answer' defined but not used [-Wunused-variable]
   21 | static bool issol, answer;
      |                    ^~~~~~
consul.cpp:21:13: warning: 'issol' defined but not used [-Wunused-variable]
   21 | static bool issol, answer;
      |             ^~~~~
consul.cpp:20:18: warning: 'a' defined but not used [-Wunused-variable]
   20 | static int Q, N, a[5005];
      |                  ^
consul.cpp:20:15: warning: 'N' defined but not used [-Wunused-variable]
   20 | static int Q, N, a[5005];
      |               ^
consul.cpp:20:12: warning: 'Q' defined but not used [-Wunused-variable]
   20 | static int Q, N, a[5005];
      |            ^
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 364 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 364 KB Output is correct
2 Correct 9 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 492 KB Output is correct
2 Correct 28 ms 364 KB Output is correct
3 Correct 9 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 24 ms 364 KB Output is correct
7 Correct 29 ms 364 KB Output is correct
8 Correct 26 ms 364 KB Output is correct
9 Correct 24 ms 364 KB Output is correct
10 Correct 25 ms 364 KB Output is correct
11 Correct 23 ms 364 KB Output is correct
12 Correct 24 ms 364 KB Output is correct
13 Correct 28 ms 364 KB Output is correct
14 Correct 31 ms 364 KB Output is correct