답안 #971418

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
971418 2024-04-28T13:23:22 Z hariaakas646 Gap (APIO16_gap) C++14
컴파일 오류
0 ms 0 KB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;

#define scd(t) scanf("%d", &t)
#define sclld(t) scanf("%lld", &t)
#define forr(i, j, k) for (int i = j; i < k; i++)
#define frange(i, j) forr(i, 0, j)
#define all(cont) cont.begin(), cont.end()
#define mp make_pair
#define pb push_back
#define f first
#define s second
typedef long long int lli;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<lli> vll;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vi> vvi;
typedef map<int, int> mpii;
typedef set<int> seti;
typedef multiset<int> mseti;
typedef long double ld;

// Subtask 1 too trivial

long long findGap(int T, int n)
{
	lli st, en;
	MinMax(0, 1e18, &st, &en);
	lli l = en - st + 1;
	lli x = (l + n - 1) / (n-1);
	lli pre = st;
	lli out = x-1;
	for(lli i=st; i<=en; i+=x) {
		lli mi, ma;
		MinMax(i, min(1e18, i+x-1), &mi, &ma);
		if(mi != -1)
			out = max(out, mi - pre);
		if(ma != -1)
		pre = ma;
	}
	return out;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:40:28: error: no matching function for call to 'min(double, lli)'
   40 |   MinMax(i, min(1e18, i+x-1), &mi, &ma);
      |                            ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
gap.cpp:40:28: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'lli' {aka 'long long int'})
   40 |   MinMax(i, min(1e18, i+x-1), &mi, &ma);
      |                            ^
In file included from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
gap.cpp:40:28: note:   deduced conflicting types for parameter 'const _Tp' ('double' and 'lli' {aka 'long long int'})
   40 |   MinMax(i, min(1e18, i+x-1), &mi, &ma);
      |                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3468:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3468 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3468:5: note:   template argument deduction/substitution failed:
gap.cpp:40:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   40 |   MinMax(i, min(1e18, i+x-1), &mi, &ma);
      |                            ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from gap.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3474:5: note:   template argument deduction/substitution failed:
gap.cpp:40:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'double'
   40 |   MinMax(i, min(1e18, i+x-1), &mi, &ma);
      |                            ^