Submission #328646

# Submission time Handle Problem Language Result Execution time Memory
328646 2020-11-17T12:46:25 Z iliccmarko CONSUL (info1cup19_consul) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include<grader.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define input(n, v) {for(int i = 0;i<n;i++) cin>>v[i];}
#define output(n, v) {for(int i = 0;i<n;i++) cout<<v[i]<<" "; cout<<endl;}
#define single_case solve();
#define line cout<<"------------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); }
using namespace std;

void solve(int n)
{
    int cnt = 0;
    int k = 30;
    if(n<=50)
        k = 25;
    int best = 0;
    int ans = -1;
    mt19937 mt_rand(time(0));
    for(int i = 0;i<k;i++)
    {
        int s = (mt_rand())%n+1;
        int w = kth(s);
        int c = cnt(w);
        if(c>best)
        {
            best = c;
            ans = w;
        }
    }
    if(best>n/3)
        say_answer(ans);
    else
        say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:32:22: error: 'cnt' cannot be used as a function
   32 |         int c = cnt(w);
      |                      ^