Submission #489778

#TimeUsernameProblemLanguageResultExecution timeMemory
489778marcoskalGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB


long long findGap(int T, int N)
{
  	long long first, last, first1, last1;
  	MinMax(0, 1000000000000000001ll, &first, &last);
  	long long step=(last-first)/(N-1);
  	vector<long long> v;
  	v.push_back(first);
  	long long ans=step, cntr=0;
  	for(int i=first;i<=last+1;i+=step)
    {
        //cout<<i+1<<" "<<i+step<<" "<<endl;
    	MinMax(i+1, i+step, &first1, &last1);
      	if(first1!=-1){
      		v.push_back(first1);
          	cntr++;
      	}
      	if(last1!=-1&&last1!=first1){
      		v.push_back(last1);
          	cntr++;
      	}
          	ans=max(ans, v[cntr]-v[cntr-1]);
    }
    //for(int i=0;i<v.size();i++)
        //cout<<v[i]<<" ";
    //cout<<endl;
	return ans;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:6:4: error: 'MinMax' was not declared in this scope
    6 |    MinMax(0, 1000000000000000001ll, &first, &last);
      |    ^~~~~~
gap.cpp:8:4: error: 'vector' was not declared in this scope
    8 |    vector<long long> v;
      |    ^~~~~~
gap.cpp:8:11: error: expected primary-expression before 'long'
    8 |    vector<long long> v;
      |           ^~~~
gap.cpp:9:4: error: 'v' was not declared in this scope
    9 |    v.push_back(first);
      |    ^
gap.cpp:23:16: error: 'max' was not declared in this scope
   23 |            ans=max(ans, v[cntr]-v[cntr-1]);
      |                ^~~