Submission #364079

# Submission time Handle Problem Language Result Execution time Memory
364079 2021-02-08T08:22:22 Z ahmedfouadnew CONSUL (info1cup19_consul) C++17
Compilation error
0 ms 0 KB
#include "grader.h"
#include "grader.cpp"
#define pb push_back
void solve(int n)
{
    vector<int>v;
    for(int i=1;i<=n;i++)
    {
        v.pb(kth(i+1));
    }
    sort(v.begin(),v.end());
    int cur=0;
    for(int i=0;i<v.size();i++)
    {
        if(!i)
        {
            cur=1;
        }
        else
        {
            if(v[i]==v[i-1])
            {
                cur++;
            }
            else cur=1;
        }
        if(cur>=n/3+1)
        {
            say_answer(v[i]);
            break;
        }
    }
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int>v;
      |     ^~~~~~
consul.cpp:6:12: error: expected primary-expression before 'int'
    6 |     vector<int>v;
      |            ^~~
consul.cpp:9:9: error: 'v' was not declared in this scope
    9 |         v.pb(kth(i+1));
      |         ^
consul.cpp:11:10: error: 'v' was not declared in this scope
   11 |     sort(v.begin(),v.end());
      |          ^
consul.cpp:11:5: error: 'sort' was not declared in this scope; did you mean 'qsort'?
   11 |     sort(v.begin(),v.end());
      |     ^~~~
      |     qsort