답안 #1041497

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041497 2024-08-02T04:51:09 Z EaglesV7(#11051) A Light Inconvenience (CEOI23_light) C++17
컴파일 오류
0 ms 0 KB
#include "light.h"
#include <bits/stdc++.h>
using namespace std;

long long cnt;
vector<long long> v[701];

void prepare(){
	cnt = 1;
	for(int i=1;i<=700;i++) {
        for(int j=1;j<=i;j+=5){
            v[i].push_back(j);
        }
        if (i%5!=1) v[i].push_back(i);
	}
}

typedef pair<long long, std::vector<long long>> iv;

iv join(long long p){
    cnt+=p;
	return iv(max(p,5),v[cnt]);
}

iv leave(long long p){
	cnt-=p;
	return iv(5,v[cnt]);
}

Compilation message

light.cpp: In function 'iv join(long long int)':
light.cpp:22:19: error: no matching function for call to 'max(long long int&, int)'
   22 |  return iv(max(p,5),v[cnt]);
      |                   ^
In file included from /usr/include/c++/10/vector:60,
                 from light.h:1,
                 from light.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
light.cpp:22:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |  return iv(max(p,5),v[cnt]);
      |                   ^
In file included from /usr/include/c++/10/vector:60,
                 from light.h:1,
                 from light.cpp:1:
/usr/include/c++/10/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++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
light.cpp:22:19: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   22 |  return iv(max(p,5),v[cnt]);
      |                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from light.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
light.cpp:22:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |  return iv(max(p,5),v[cnt]);
      |                   ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from light.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
light.cpp:22:19: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |  return iv(max(p,5),v[cnt]);
      |                   ^