제출 #1148165

#제출 시각아이디문제언어결과실행 시간메모리
1148165Kaztaev_AlisherMeetings (IOI18_meetings)C++20
컴파일 에러
0 ms0 KiB
#include "meetings.h"
#include <bits/stdc++.h>

#define ios ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define file(s) if (fopen(s".in", "r")) freopen(s".in", "r", stdin), freopen(s".out", "w", stdout)
#define all(a) a.begin() , a.end()
#define F first
#define S second
// #define int ll 

using namespace std;
using ll = long long;

const ll N = 5555 , inf = 2e9 + 7;
const ll INF = 1e18 ,   mod = 1e9+7;

ll pr[N][N] , sf[N][N] , a[N];
vector<long long> minimum_costs(vector<int> H, vector<int> L, vector<int> R) {
	int Q = L.size();
	int n = H.size();
	vector<long long> C(Q);
	for(int i = 1; i <= n; i++){
		a[i] = H[i-1];
	}
	for(int l = 1; l <= n; l++){
		int mx = a[l];
		for(int r = l; r <= n; r++){
			mx = max(mx , a[r]);
			pr[l][r] = pr[l][r-1] + mx;
		}	
	}
	for(int r = n; r >= 1; r--){
		int mx = a[r];
		for(int l = r; l >= 1; l--){
			mx = max(mx , a[l]);
			sf[r][l] = sf[r][l+1] + mx;
		}	
	}
	for(int i = 0; i < Q; i++){
		L[i]++;
		R[i]++;
		C[i] = inf;
		for(int j = L[i]; j <= R[i]; j++){
			C[i] = min(C[i] , pr[L[i]][j-1]+sf[R[i]][j+1]+a[j]);
		}
	}
	return C;
}

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

meetings.cpp: In function 'std::vector<long long int> minimum_costs(std::vector<int>, std::vector<int>, std::vector<int>)':
meetings.cpp:28:33: error: no matching function for call to 'max(int&, ll&)'
   28 |                         mx = max(mx , a[r]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
meetings.cpp:28:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   28 |                         mx = max(mx , a[r]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
meetings.cpp:28:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   28 |                         mx = max(mx , a[r]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:62,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
meetings.cpp:28:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |                         mx = max(mx , a[r]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:62,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
meetings.cpp:28:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   28 |                         mx = max(mx , a[r]);
      |                              ~~~^~~~~~~~~~~
meetings.cpp:35:33: error: no matching function for call to 'max(int&, ll&)'
   35 |                         mx = max(mx , a[l]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
meetings.cpp:35:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   35 |                         mx = max(mx , a[l]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:60,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
meetings.cpp:35:33: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   35 |                         mx = max(mx , a[l]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:62,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
meetings.cpp:35:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |                         mx = max(mx , a[l]);
      |                              ~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/vector:62,
                 from meetings.h:3,
                 from meetings.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
meetings.cpp:35:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   35 |                         mx = max(mx , a[l]);
      |                              ~~~^~~~~~~~~~~