int main()
{
  // find the subsequence
  std::pair<int*, int*> seq = max_subseq(array, end(array));

  // output it
  std::copy(seq.first, seq.second, std::ostream_iterator<int>(std::cout, " "));
  std::cout << std::endl;

  return 0;
}
Example #2
0
int main()
{
	int a[99999];
	int i, n;
	FILE *in;
	in = fopen("data.in", "r");
	fscanf(in, "%d", &n);
	for (i = 0; i < n; i++)
		fscanf(in, "%d", &a[i]);
	printf("%d\n", max_subseq(a, n));
	fclose(in);
}