답안 #383247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383247 2021-03-29T09:54:19 Z Ahmad_Hasan CONSUL (info1cup19_consul) C++17
100 / 100
38 ms 380 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/2);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:20:20: warning: 'answer' defined but not used [-Wunused-variable]
   20 | static bool issol, answer;
      |                    ^~~~~~
consul.cpp:20:13: warning: 'issol' defined but not used [-Wunused-variable]
   20 | static bool issol, answer;
      |             ^~~~~
consul.cpp:19:18: warning: 'a' defined but not used [-Wunused-variable]
   19 | static int Q, N, a[5005];
      |                  ^
consul.cpp:19:15: warning: 'N' defined but not used [-Wunused-variable]
   19 | static int Q, N, a[5005];
      |               ^
consul.cpp:19:12: warning: 'Q' defined but not used [-Wunused-variable]
   19 | static int Q, N, a[5005];
      |            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 364 KB Output is correct
2 Correct 9 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 28 ms 364 KB Output is correct
2 Correct 29 ms 364 KB Output is correct
3 Correct 8 ms 364 KB Output is correct
4 Correct 10 ms 364 KB Output is correct
5 Correct 24 ms 364 KB Output is correct
6 Correct 27 ms 364 KB Output is correct
7 Correct 23 ms 364 KB Output is correct
8 Correct 31 ms 364 KB Output is correct
9 Correct 24 ms 364 KB Output is correct
10 Correct 20 ms 380 KB Output is correct
11 Correct 25 ms 364 KB Output is correct
12 Correct 37 ms 364 KB Output is correct
13 Correct 38 ms 364 KB Output is correct
14 Correct 25 ms 364 KB Output is correct