Submission #47276

# Submission time Handle Problem Language Result Execution time Memory
47276 2018-04-30T05:58:16 Z yogahmad Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
long long findGap(int T, int N)
{
//	cout<<T<<" "<<N<<endl;
	long long sa,du,ti,em;
	vector<long long>ve;
	long long *kiri,*kanan;
	kiri=&sa;
	kanan=&du;
	MinMax(0,1e18,kiri,kanan);
//	cout<<*kiri<<' '<<*kanan<<endl;
	long long gap=(*kanan-*kiri)/(N-1);
	long long jaw=0;
//	cout<<*kiri<<" "<<*kanan<<" "<<gap<<endl;
	long long awal;
	for(awal=*kiri;awal<=*kanan;awal+=gap+1){
	//	cout<<awal<<" <<<___\n";
		long long *lo,*hi;
		lo=&ti;
		hi=&em;
		MinMax(awal,awal+gap,lo,hi);
	//	cout<<awal<<' '<<awal+gap<<" -> "<<*lo<<" "<<*hi<<endl;
		if(*lo==-1 && *hi==-1)
			continue;
		ve.push_back(*lo);
		ve.push_back(*hi);
	}
//	cout<<awal<<endl;
	sort(ve.begin(),ve.end());
//	for(int i:ve)
	//	cout<<i<<' ';
//	cout<<endl;
	for(int i=1;i<ve.size();i++){
		jaw=max(jaw,ve[i]-ve[i-1]);
	}
//	cout<<jaw<<endl;
	return jaw;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:5:2: error: 'vector' was not declared in this scope
  vector<long long>ve;
  ^~~~~~
gap.cpp:5:9: error: expected primary-expression before 'long'
  vector<long long>ve;
         ^~~~
gap.cpp:9:2: error: 'MinMax' was not declared in this scope
  MinMax(0,1e18,kiri,kanan);
  ^~~~~~
gap.cpp:24:3: error: 've' was not declared in this scope
   ve.push_back(*lo);
   ^~
gap.cpp:28:7: error: 've' was not declared in this scope
  sort(ve.begin(),ve.end());
       ^~
gap.cpp:28:2: error: 'sort' was not declared in this scope
  sort(ve.begin(),ve.end());
  ^~~~
gap.cpp:28:2: note: suggested alternative: 'short'
  sort(ve.begin(),ve.end());
  ^~~~
  short
gap.cpp:33:7: error: 'max' was not declared in this scope
   jaw=max(jaw,ve[i]-ve[i-1]);
       ^~~