Submission #609509

# Submission time Handle Problem Language Result Execution time Memory
609509 2022-07-27T16:29:48 Z sword060 Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
vector<long long>a;
void rec(long long l,long long r){
  if(l>r)return;
  long long c,v;
  MinMax(l,r,&c,&v);
  if(c==-1)return;
  a.push_back(c);a.push_back(v);
  if(c==v||c==v-1)return;
  rec(c+1,(c+v)/2);rec((c+v)/2+1,v-1);
}
long long findGap(int q,int x){
  //if(q==1)rec(0,1e18);
  //else{
    long long c=0,v=1e18,zz=x;
    while(zz&&c<=v){
      long long l,r;
      MinMax(c,v,&l,&r);
      if(l==-1)break;
      a.push_back(l);if(l!=r)a.push_back(r);
      c=l+1;v=r-1;zz-=2;
    }
  //}
  sort(a.begin(),a.end());
  long long ret=0;
  for(int i=0;i<(int)a.size()-1;i++)ret=max(ret,a[i+1]-a[i]);
  return ret;
}

Compilation message

gap.cpp:15:2: error: extended character   is not valid in an identifier
   15 |   //if(q==1)rec(0,1e18);
      |  ^
gap.cpp:16:2: error: extended character   is not valid in an identifier
   16 |   //else{
      |  ^
gap.cpp:25:2: error: extended character   is not valid in an identifier
   25 |   //}
      |  ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:15:2: error: '\U000000a0' was not declared in this scope
   15 |   //if(q==1)rec(0,1e18);
      |  ^
gap.cpp:18:11: error: 'zz' was not declared in this scope
   18 |     while(zz&&c<=v){
      |           ^~
gap.cpp:18:15: error: 'c' was not declared in this scope
   18 |     while(zz&&c<=v){
      |               ^
gap.cpp:18:18: error: 'v' was not declared in this scope
   18 |     while(zz&&c<=v){
      |                  ^
gap.cpp:25:4: error: expected ';' before 'sort'
   25 |   //}
      |   ^
      |   ;
   26 |   sort(a.begin(),a.end());
      |   ~~~~