Submission #50994

# Submission time Handle Problem Language Result Execution time Memory
50994 2018-06-15T13:58:01 Z alenam0161 Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include "gap.h"
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long findGap(int T, int N)
{
	if (N == 0)return 0;
	long long ans = 0;
	long long inf = 1e18 + 1;
	long long  fi=long long(-1);
	long long   se=long long(inf);
	vector<long long> a, b;
	while (true) {
		MinMax(fi, se, &fi, &se);
		if(fi!=-1)
		a.push_back(fi);
		if(se!=-1)
		b.push_back(se);
		if (fi == -1 || se == -1)break;
		fi++;
		se--;
		if (fi >= se)break;
	}
	for (int i = b.size() - 1; i >= 0; i--)a.push_back(b[i]);
	for (int i = 1; i < a.size(); ++i) {
		ans = max(ans, a[i] - a[i - 1]);
	}
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:16: error: expected primary-expression before 'long'
  long long  fi=long long(-1);
                ^~~~
gap.cpp:12:17: error: expected primary-expression before 'long'
  long long   se=long long(inf);
                 ^~~~
gap.cpp:26:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 1; i < a.size(); ++i) {
                  ~~^~~~~~~~~~
gap.cpp:10:12: warning: unused variable 'inf' [-Wunused-variable]
  long long inf = 1e18 + 1;
            ^~~