제출 #1323936

#제출 시각아이디문제언어결과실행 시간메모리
1323936aritro_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()

void MinMax(ll s,ll t,ll &mn,ll &mn);

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:8:34: error: redefinition of 'll& mn'
    8 | void MinMax(ll s,ll t,ll &mn,ll &mn);
      |                              ~~~~^~
gap.cpp:8:27: note: 'll& mn' previously declared here
    8 | void MinMax(ll s,ll t,ll &mn,ll &mn);
      |                       ~~~~^~
gap.cpp: In function 'll findGap(ll, ll)':
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:15:13: note: in expansion of macro 'pb'
   15 |         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:16:22: note: in expansion of macro 'pb'
   16 |         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:20:40: error: 'a' was not declared in this scope
   20 |     for(int i=0;i<n-1;i++) res=max(res,a[i+1]-a[i]);
      |                                        ^