Submission #523484

# Submission time Handle Problem Language Result Execution time Memory
523484 2022-02-07T17:31:40 Z AGE CONSUL (info1cup19_consul) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "grader.h"
#define int long long 
void solve(int N){
int n=N;
map<int,int>mpp;
int cntt=min(N/2,(int)30);
    while(cntt>=0){
        int x=rand()%n;
        if(mpp[x])continue;
        int y=kth(x+1);
        int yy=cnt(y);
        if(yy>n/3){
            say_answer(y);
            return ;
        }
        mpp[x]=1;
        cntt--;
    }
    say_answer(-1);

}

Compilation message

consul.cpp: In function 'void solve(long long int)':
consul.cpp:6:1: error: 'map' was not declared in this scope; did you mean 'std::map'?
    6 | map<int,int>mpp;
      | ^~~
      | std::map
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from consul.cpp:1:
/usr/include/c++/10/bits/stl_map.h:100:11: note: 'std::map' declared here
  100 |     class map
      |           ^~~
consul.cpp:3:13: error: expected primary-expression before 'long'
    3 | #define int long long
      |             ^~~~
consul.cpp:6:5: note: in expansion of macro 'int'
    6 | map<int,int>mpp;
      |     ^~~
consul.cpp:7:10: error: 'min' was not declared in this scope; did you mean 'std::min'?
    7 | int cntt=min(N/2,(int)30);
      |          ^~~
      |          std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from consul.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
consul.cpp:10:12: error: 'mpp' was not declared in this scope
   10 |         if(mpp[x])continue;
      |            ^~~
consul.cpp:17:9: error: 'mpp' was not declared in this scope
   17 |         mpp[x]=1;
      |         ^~~