Submission #242051

#TimeUsernameProblemLanguageResultExecution timeMemory
242051michaoGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "gap.h"
#define int long long
const int inf=1e18*2;
using namespace std;
vi answer,pom;
int n;
long long findGap(int t,int N)
{
	n=N;
	int ans=0;
	int ip=-1,ik=inf;
	if (t==1)
	{
		while (sz(answer)+sz(pom)<n)
		{
			ip++,ik--;
			MinMax(ip,ik,&ip,&ik);
			answer.pb(ip);
			pom.pb(ik);
		}
	}
	else
	{
		assert(false);
	}
	while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
	for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
	return ans;
}

Compilation message (stderr)

gap.cpp:6:1: error: 'vi' does not name a type
 vi answer,pom;
 ^~
gap.cpp: In function 'long long int findGap(long long int, long long int)':
gap.cpp:15:13: error: 'answer' was not declared in this scope
   while (sz(answer)+sz(pom)<n)
             ^~~~~~
gap.cpp:15:13: note: suggested alternative: 'ans'
   while (sz(answer)+sz(pom)<n)
             ^~~~~~
             ans
gap.cpp:15:10: error: 'sz' was not declared in this scope
   while (sz(answer)+sz(pom)<n)
          ^~
gap.cpp:15:24: error: 'pom' was not declared in this scope
   while (sz(answer)+sz(pom)<n)
                        ^~~
gap.cpp:15:24: note: suggested alternative: 'pow'
   while (sz(answer)+sz(pom)<n)
                        ^~~
                        pow
gap.cpp:27:12: error: 'pom' was not declared in this scope
  while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
            ^~~
gap.cpp:27:12: note: suggested alternative: 'pow'
  while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
            ^~~
            pow
gap.cpp:27:9: error: 'sz' was not declared in this scope
  while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
         ^~
gap.cpp:27:19: error: 'answer' was not declared in this scope
  while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
                   ^~~~~~
gap.cpp:27:19: note: suggested alternative: 'ans'
  while (sz(pom)>0)answer.pb(pom.back()),pom.pop_back();
                   ^~~~~~
                   ans
gap.cpp:28:20: error: 'answer' was not declared in this scope
  for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                    ^~~~~~
gap.cpp:28:20: note: suggested alternative: 'ans'
  for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                    ^~~~~~
                    ans
gap.cpp:28:17: error: 'sz' was not declared in this scope
  for (int i=0;i<sz(answer)-1;i++)ans=max(ans,answer[i+1]-answer[i]);
                 ^~