# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
148237 | 2019-08-31T18:13:02 Z | 조팍시\n123(#3740, tlwpdus, ainta, cki86201) | 포도주 시음 (FXCUP4_wine) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include <bits/stdc++.h> #include "bartender.h" using namespace std; #define Fi first #define Se second typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define all(x) (x).begin(), (x).end() #define pb push_back #define szz(x) (int)(x).size() #define rep(i, n) for(int i=0;i<(n);i++) typedef tuple<int, int, int> t3; #define i128 __int128 i128 fact[33]; i128 C[33][33]; i128 get_code1(vector <int> v1) { int m = szz(v1); i128 res = 0; for(int i=0;i<m-1;i++) { int cnt = 0; for(int j=i+1;j<m;j++) if(v1[j] < v1[i]) ++cnt; res += fact[m-1-i] * cnt; } return res; } i128 get_C(int a, int b) { if(a < 0 || b < 0) return 0; return fact[a+b] / fact[a] / fact[b]; } i128 get_code(vector <int> R) { int N = szz(R); int B = min(N, 11); sort(R.begin(), R.begin() + B); i128 r = 0, mul = fact[N - R]; if(R < N) { vector <int> v1; for(int i=R;i<N;i++) v1.pb(R[i]); i128 g1 = get_code1(v1); r += g1; sort(R.begin() + B, R.end()); } vector <pii> V; for(int i=0;i<B;i++) V.pb(pii(R[i], 0)); for(int i=B;i<N;i++) V.pb(pii(R[i], 1)); sort(all(V)); int na = B, nb = N - B; i128 sum = 0; for(int i=0;i<N;i++) { int x = V[i].Se; if(x == 1) { sum += get_C(na - 1, nb); --nb; } else --na; } r += sum * mul; return r; } i128 pw(i128 x, i128 y) { i128 res = 1; while(y) { if(y & 1) res = res * x; x = x * x; y >>= 1; } return res; } vector <int> Encode(int N, i128 X) { int B = min(11, N); i128 rem = pw(9, N - B); i128 r1 = X / rem; i128 r2 = X % rem; vector <int> res(N); for(int i=B;i<N;i++) { res[i] = r2 % 9; r2 /= 9; } i128 t1 = pw(4, B); } std::vector<int> BlendWines(int K, std::vector<int> R) { fact[0] = 1; for(int i=1;i<33;i++)fact[i] = (i128) i * fact[i-1]; rep(i, 33) { C[i][0] = 1; for(int j=1;j<=i;j++) C[i][j] = (C[i-1][j-1] + C[i-1][j]); } i128 r = get_code(R); vector <int> R = Encode(szz(R), r); return R; }
#include <bits/stdc++.h> #include "taster.h" using namespace std; #define Fi first #define Se second typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; #define all(x) (x).begin(), (x).end() #define pb push_back #define szz(x) (int)(x).size() #define rep(i, n) for(int i=0;i<(n);i++) typedef tuple<int, int, int> t3; #define i128 __int128 std::vector<int> SortWines(int K, std::vector<int> A) { i128 x = 0; return A; }
Compilation message
bartender.cpp: In function '__int128 get_code(std::vector<int>)': bartender.cpp:40:27: error: no match for 'operator-' (operand types are 'int' and 'std::vector<int>') i128 r = 0, mul = fact[N - R]; ~~^~~ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/specfun.h:45, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from bartender.cpp:1: /usr/include/c++/7/bits/stl_iterator.h:389:5: note: candidate: template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&) operator-(const reverse_iterator<_IteratorL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:389:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/specfun.h:45, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from bartender.cpp:1: /usr/include/c++/7/bits/stl_iterator.h:1191:5: note: candidate: template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&) operator-(const move_iterator<_IteratorL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:1191:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/ccomplex:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from bartender.cpp:1: /usr/include/c++/7/complex:356:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const std::complex<_Tp>&) operator-(const complex<_Tp>& __x, const complex<_Tp>& __y) ^~~~~~~~ /usr/include/c++/7/complex:356:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::complex<_Tp>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/ccomplex:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from bartender.cpp:1: /usr/include/c++/7/complex:365:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&, const _Tp&) operator-(const complex<_Tp>& __x, const _Tp& __y) ^~~~~~~~ /usr/include/c++/7/complex:365:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::complex<_Tp>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/ccomplex:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from bartender.cpp:1: /usr/include/c++/7/complex:374:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const _Tp&, const std::complex<_Tp>&) operator-(const _Tp& __x, const complex<_Tp>& __y) ^~~~~~~~ /usr/include/c++/7/complex:374:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: 'std::vector<int>' is not derived from 'const std::complex<_Tp>' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/ccomplex:39:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:52, from bartender.cpp:1: /usr/include/c++/7/complex:451:5: note: candidate: template<class _Tp> std::complex<_Tp> std::operator-(const std::complex<_Tp>&) operator-(const complex<_Tp>& __x) ^~~~~~~~ /usr/include/c++/7/complex:451:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::complex<_Tp>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/deque:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:68, from bartender.cpp:1: /usr/include/c++/7/bits/stl_deque.h:351:5: note: candidate: template<class _Tp, class _Ref, class _Ptr> typename std::_Deque_iterator<_Tp, _Ref, _Ptr>::difference_type std::operator-(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _Ref, _Ptr>&) operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_deque.h:351:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/deque:64:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:68, from bartender.cpp:1: /usr/include/c++/7/bits/stl_deque.h:363:5: note: candidate: template<class _Tp, class _RefL, class _PtrL, class _RefR, class _PtrR> typename std::_Deque_iterator<_Tp, _Ref, _Ptr>::difference_type std::operator-(const std::_Deque_iterator<_Tp, _Ref, _Ptr>&, const std::_Deque_iterator<_Tp, _RefR, _PtrR>&) operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x, ^~~~~~~~ /usr/include/c++/7/bits/stl_deque.h:363:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::_Deque_iterator<_Tp, _Ref, _Ptr>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/vector:65:0, from /usr/include/c++/7/functional:61, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:71, from bartender.cpp:1: /usr/include/c++/7/bits/stl_bvector.h:208:3: note: candidate: std::ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const std::_Bit_iterator_base&) operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) ^~~~~~~~ /usr/include/c++/7/bits/stl_bvector.h:208:3: note: no known conversion for argument 1 from 'int' to 'const std::_Bit_iterator_base&' In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from bartender.cpp:1: /usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom1, class _Dom2> std::_Expr<std::_BinClos<std::__minus, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::_Expr<_Dom2, typename _Dom2::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/bits/valarray_after.h:403:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from bartender.cpp:1: /usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&) _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/bits/valarray_after.h:403:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from bartender.cpp:1: /usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const typename _Dom::value_type&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/bits/valarray_after.h:403:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from bartender.cpp:1: /usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::_Expr<_Dom1, typename _Dom1::value_type>&, const std::valarray<typename _Dom::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/bits/valarray_after.h:403:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/valarray:592:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95, from bartender.cpp:1: /usr/include/c++/7/bits/valarray_after.h:403:5: note: candidate: template<class _Dom> std::_Expr<std::_BinClos<std::__minus, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__minus, typename _Dom1::value_type>::result_type> std::operator-(const std::valarray<typename _Dom::value_type>&, const std::_Expr<_Dom1, typename _Dom1::value_type>&) _DEFINE_EXPR_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/bits/valarray_after.h:403:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: 'std::vector<int>' is not derived from 'const std::_Expr<_Dom1, typename _Dom1::value_type>' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from bartender.cpp:1: /usr/include/c++/7/valarray:1173:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__minus, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/valarray:1173:1: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::valarray<_Tp>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from bartender.cpp:1: /usr/include/c++/7/valarray:1173:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__minus, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const std::valarray<_Tp>&, const _Tp&) _DEFINE_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/valarray:1173:1: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const std::valarray<_Tp>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:95:0, from bartender.cpp:1: /usr/include/c++/7/valarray:1173:1: note: candidate: template<class _Tp> std::_Expr<std::_BinClos<std::__minus, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__minus, _Tp>::result_type> std::operator-(const _Tp&, const std::valarray<_Tp>&) _DEFINE_BINARY_OPERATOR(-, __minus) ^ /usr/include/c++/7/valarray:1173:1: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: 'std::vector<int>' is not derived from 'const std::valarray<_Tp>' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/specfun.h:45, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from bartender.cpp:1: /usr/include/c++/7/bits/stl_iterator.h:962:5: note: candidate: template<class _Iterator, class _Container> typename __gnu_cxx::__normal_iterator<_Iterator, _Container>::difference_type __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&) operator-(const __normal_iterator<_Iterator, _Container>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:962:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const __gnu_cxx::__normal_iterator<_Iterator, _Container>' and 'int' i128 r = 0, mul = fact[N - R]; ^ In file included from /usr/include/c++/7/bits/stl_algobase.h:67:0, from /usr/include/c++/7/bits/specfun.h:45, from /usr/include/c++/7/cmath:1914, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41, from bartender.cpp:1: /usr/include/c++/7/bits/stl_iterator.h:950:5: note: candidate: template<class _IteratorL, class _IteratorR, class _Container> decltype ((__lhs.base() - __rhs.base())) __gnu_cxx::operator-(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&) operator-(const __normal_iterator<_IteratorL, _Container>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/stl_iterator.h:950:5: note: template argument deduction/substitution failed: bartender.cpp:40:29: note: mismatched types 'const __gnu_cxx::__normal_iterator<_IteratorL, _Container>' and 'int' i128 r = 0, mul = fact[N - R]; ^ bartender.cpp:41:7: error: no match for 'operator<' (operand types are 'std::vector<int>' and 'int') if(R < N) { ~~^~~ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from bartender.cpp:1: /usr/include/c++/7/bits/regex.h:962:5: note: candidate: template<class _BiIter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&) operator<(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs) ^~~~~~~~ /usr/include/c++/7/bits/regex.h:962:5: note: template argument deduction/substitution failed: bartender.cpp:41:9: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(R < N) { ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from bartender.cpp:1: /usr/include/c++/7/bits/regex.h:1041:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&) operator<(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1041:5: note: template argument deduction/substitution failed: bartender.cpp:41:9: note: 'std::vector<int>' is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>' if(R < N) { ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from bartender.cpp:1: /usr/include/c++/7/bits/regex.h:1121:5: note: candidate: template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&) operator<(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1121:5: note: template argument deduction/substitution failed: bartender.cpp:41:9: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(R < N) { ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from bartender.cpp:1: /usr/include/c++/7/bits/regex.h:1198:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&) operator<(typename iterator_traits<_Bi_iter>::value_type const* __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1198:5: note: template argument deduction/substitution failed: bartender.cpp:41:9: note: mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int' if(R < N) { ^ In file included from /usr/include/c++/7/regex:62:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:110, from bartender.cpp:1: /usr/include/c++/7/bits/regex.h:1272:5: note: candidate: template<class _Bi_iter> bool std::__cxx11::operator<(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*) operator<(const sub_match<_Bi_iter>& __lhs, ^~~~~~~~ /usr/include/c++/7/bits/regex.h:1272:5: note: template argument deduction/substitution failed: bartender.cpp:41:9: note: 'std::vector<int>' is not derived from 'const std::__cxx11::sub_match<_BiIter>' if(R < N) { ^ In file included from /usr/includ taster.cpp: In function 'std::vector<int> SortWines(int, std::vector<int>)': taster.cpp:19:7: warning: unused variable 'x' [-Wunused-variable] i128 x = 0; ^