제출 #554356

#제출 시각아이디문제언어결과실행 시간메모리
554356AmShZGap (APIO16_gap)C++11
컴파일 에러
0 ms0 KiB
//khodaya khodet komak kon # include <bits/stdc++.h> # include "gap.h" using namespace std; typedef long long ll; typedef long double ld; typedef pair <int, int> pii; typedef pair <pii, int> ppi; typedef pair <int, pii> pip; typedef pair <pii, pii> ppp; typedef pair <ll, ll> pll; # define A first # define B second # define endl '\n' # define sep ' ' # define all(x) x.begin(), x.end() # define kill(x) return cout << x << endl, 0 # define SZ(x) int(x.size()) # define lc id << 1 # define rc id << 1 | 1 # define fast_io ios::sync_with_stdio(0);cin.tie(0); cout.tie(0); ll power(ll a, ll b, ll md) {return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));} const int xn = 1e6 + 10; const int xm = - 20 + 10; const int sq = 320; const int inf = 1e9 + 10; const ll INF = 1e18 + 10; const ld eps = 1e-15; const int mod = 1e9 + 7;//998244353; const int base = 257; ll findGap(int T, int n){ ll L, R, ans = 0, mn, mx; MinMax(0, INF, &L, &R); vector <ll> vec; vec.push_back(L); vec.push_back(R); if (T == 1){ int l = 2, r = n - 1; mn = L, mx = R; while (l <= r){ MinMax(mn + 1, mx - 1, &mn, &mx); vec.push_back(mn, mx); ++ l, -- r; } } else{ ll t = (R - L + n) / (n - 1); ans = t; ll last = L; while (last < R){ MinMax(last + 1, last + t, &mn, &mx); vec.push_back(mn); vec.push_back(mx); last += t; } } sort(all(vec)); for (int i = 1; i < SZ(vec); ++ i) ans = max(ans, vec[i] - vec[i - 1]); return ans; } /* int main(){ fast_io; return 0; } */

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

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:48:24: error: no matching function for call to 'std::vector<long long int>::push_back(ll&, ll&)'
   48 |    vec.push_back(mn, mx);
      |                        ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:7: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::value_type = long long int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note:   candidate expects 1 argument, 2 provided