제출 #1323934

#제출 시각아이디문제언어결과실행 시간메모리
1323934aritro_Gap (APIO16_gap)C++20
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
#define int ll
#define pb push_back()

ll findGap(int t,int n){
    ll l=-1,r=1e18 + 1;
    vector<int> ans;
    for(int i=0;i<=(n+1)/2;i++){
        MinMax(l+1,r-1,&l,&r);
        ans.pb(l);
        if(l!=r) ans.pb(r);
    }
    sort(ans.begin(),ans.end());
    int res=0;
    for(int i=0;i<n-1;i++) res=max(res,a[i+1]-a[i]);
    return res;
}

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

gap.cpp: In function 'll findGap(ll, ll)':
gap.cpp:12:9: error: 'MinMax' was not declared in this scope
   12 |         MinMax(l+1,r-1,&l,&r);
      |         ^~~~~~
gap.cpp:6:21: error: no matching function for call to 'std::vector<long long int>::push_back()'
    6 | #define pb push_back()
      |                     ^
gap.cpp:13:13: note: in expansion of macro 'pb'
   13 |         ans.pb(l);
      |             ^~
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53,
                 from gap.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:1281:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1281 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1281:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/13/bits/stl_vector.h:1298:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1298 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1298:7: note:   candidate expects 1 argument, 0 provided
gap.cpp:6:21: error: no matching function for call to 'std::vector<long long int>::push_back()'
    6 | #define pb push_back()
      |                     ^
gap.cpp:14:22: note: in expansion of macro 'pb'
   14 |         if(l!=r) ans.pb(r);
      |                      ^~
/usr/include/c++/13/bits/stl_vector.h:1281:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1281 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1281:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/13/bits/stl_vector.h:1298:7: note: candidate: 'constexpr void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; value_type = long long int]'
 1298 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:1298:7: note:   candidate expects 1 argument, 0 provided
gap.cpp:18:40: error: 'a' was not declared in this scope
   18 |     for(int i=0;i<n-1;i++) res=max(res,a[i+1]-a[i]);
      |                                        ^