제출 #713214

#제출 시각아이디문제언어결과실행 시간메모리
713214bin9638Gap (APIO16_gap)C++17
컴파일 에러
0 ms0 KiB
`#include <bits/stdc++.h>
 
#ifndef SKY
#include "gap.h"
#endif // SKY
 
using namespace std;
 
#define ll long long
#define pb push_back
#define N 100010
#define ii pair<int,int>
#define fs first
#define sc second
#define ld double
 
int n;
 
#ifdef SKY
ll a[N],am=-1,mn,mx;
void MinMax(ll s,ll t, ll *u, ll *v)
{
    if(s>t)
    {
        cout<<"NGU VC";
        exit(0);
    }
    if(s>a[n]||a[lower_bound(a+1,a+1+n,s)-a]>t)
    {
        mn=-1;
        mx=-1;
        return;
    }
    mn=a[lower_bound(a+1,a+1+n,s)-a];
    if(t>=a[n])
    {
        mx=a[n];
        return;
    }
    mx=a[prev(upper_bound(a+1,a+1+n,t))-a];
}
#endif
 
long long findGap(int T, int cc)
{
  	throw 1;
    n=cc;
    ll L=0,R=1e18;
    vector<ll>s;
  	int cnt=0;
    while(L<=R)
    {
      cnt++;
      if(cnt*2>(n+1))
        break;
        ll u,v;
        MinMax(L,R,&u,&v);
        #ifdef SKY
        u=mn;v=mx;
        #endif // SKY
        //cout<<L<<" "<<R<<" "<<u<<" "<<v<<endl;
        if(u==-1)
            break;
        s.pb(u);
        s.pb(v);
        L=u+1;
        R=v-1;
    }
    sort(s.begin(),s.end());
    s.erase(unique(s.begin(),s.end()),s.end());
    ll res=0;
    for(int i=0;i<s.size()-1;i++)
        res=max(res,s[i+1]-s[i]);
	return res;
}
 
#ifdef SKY
int main()
{
    freopen("A.inp","r",stdin);
    freopen("A.out","w",stdout);
    int n,T;
    cin>>T>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    cout<<findGap(T,n)<<endl;
    return 0;
}
#endif // SKY

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp:1:1: error: stray '`' in program
    1 | `#include <bits/stdc++.h>
      | ^
gap.cpp:1:2: error: stray '#' in program
    1 | `#include <bits/stdc++.h>
      |  ^
gap.cpp:1:3: error: 'include' does not name a type
    1 | `#include <bits/stdc++.h>
      |   ^~~~~~~
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:49:5: error: 'vector' was not declared in this scope
   49 |     vector<ll>s;
      |     ^~~~~~
gap.cpp:5:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
    4 | #include "gap.h"
  +++ |+#include <vector>
    5 | #endif // SKY
gap.cpp:9:12: error: expected primary-expression before 'long'
    9 | #define ll long long
      |            ^~~~
gap.cpp:49:12: note: in expansion of macro 'll'
   49 |     vector<ll>s;
      |            ^~
gap.cpp:57:9: error: 'MinMax' was not declared in this scope
   57 |         MinMax(L,R,&u,&v);
      |         ^~~~~~
gap.cpp:64:9: error: 's' was not declared in this scope
   64 |         s.pb(u);
      |         ^
gap.cpp:69:10: error: 's' was not declared in this scope
   69 |     sort(s.begin(),s.end());
      |          ^
gap.cpp:69:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   69 |     sort(s.begin(),s.end());
      |     ^~~~
      |     short
gap.cpp:70:13: error: 'unique' was not declared in this scope
   70 |     s.erase(unique(s.begin(),s.end()),s.end());
      |             ^~~~~~
gap.cpp:73:13: error: 'max' was not declared in this scope
   73 |         res=max(res,s[i+1]-s[i]);
      |             ^~~
gap.cpp:72:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   72 |     for(int i=0;i<s.size()-1;i++)
      |     ^~~
gap.cpp:74:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   74 |  return res;
      |  ^~~~~~