답안 #627321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
627321 2022-08-12T12:50:05 Z sword060 Gap (APIO16_gap) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
long long findGap(int q,int x){
  if(q==2){
    long long l=0,r=1e18;
    MinMax(l,r,&l,&r);
   long long xd=l,lol=(r-l+x-2)/(x-1),ans=lol,c1,c2,i=l;
    while(i+lol<r){
      MinMax(i,i+lol,&c1,&c2);
      if(c1!=-1)ans=max(ans,c1-xd),xd=c2;
      i+=lol+1;
    }
    MinMax(i,r,&c1,&c2);
    if(c1!=-1)ans=max(ans,c1-xd);
    return ans;
  }else{
    vector<long long>a;
    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;
  }
  return 0;
}

Compilation message

gap.cpp:8:2: error: extended character   is not valid in an identifier
    8 |    long long xd=l,lol=(r-l+x-2)/(x-1),ans=lol,c1,c2,i=l;
      |  ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:8:2: error: '\U000000a0' was not declared in this scope
    8 |    long long xd=l,lol=(r-l+x-2)/(x-1),ans=lol,c1,c2,i=l;
      |  ^
gap.cpp:9:11: error: 'i' was not declared in this scope
    9 |     while(i+lol<r){
      |           ^
gap.cpp:9:13: error: 'lol' was not declared in this scope; did you mean 'logl'?
    9 |     while(i+lol<r){
      |             ^~~
      |             logl
gap.cpp:10:23: error: 'c1' was not declared in this scope; did you mean 'y1'?
   10 |       MinMax(i,i+lol,&c1,&c2);
      |                       ^~
      |                       y1
gap.cpp:10:27: error: 'c2' was not declared in this scope
   10 |       MinMax(i,i+lol,&c1,&c2);
      |                           ^~
gap.cpp:11:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |       if(c1!=-1)ans=max(ans,c1-xd),xd=c2;
      |                 ^~~
      |                 abs
gap.cpp:11:32: error: 'xd' was not declared in this scope; did you mean 'x'?
   11 |       if(c1!=-1)ans=max(ans,c1-xd),xd=c2;
      |                                ^~
      |                                x
gap.cpp:14:12: error: 'i' was not declared in this scope
   14 |     MinMax(i,r,&c1,&c2);
      |            ^
gap.cpp:14:17: error: 'c1' was not declared in this scope; did you mean 'y1'?
   14 |     MinMax(i,r,&c1,&c2);
      |                 ^~
      |                 y1
gap.cpp:14:21: error: 'c2' was not declared in this scope
   14 |     MinMax(i,r,&c1,&c2);
      |                     ^~
gap.cpp:15:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |     if(c1!=-1)ans=max(ans,c1-xd);
      |               ^~~
      |               abs
gap.cpp:15:30: error: 'xd' was not declared in this scope; did you mean 'x'?
   15 |     if(c1!=-1)ans=max(ans,c1-xd);
      |                              ^~
      |                              x
gap.cpp:16:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   16 |     return ans;
      |            ^~~
      |            abs