# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
432546 | Andyvanh1 | 비스킷 담기 (IOI20_biscuits) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "biscuits.h"
using namespace std;
#define vt vector
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rep(i,x) for(int (i) = 0; (i) < (x); (i)++)
typedef long long ll;
typedef long double ld;
typedef vt<int> vi;
typedef pair<int,int> pii;
vt<ll> A;
ll X;
int k;
bool works(ll cur){
ll now = 0;
ll lat = 0;
for(int i = 0; i < 60; i++){
if(i<k)
now+=A[i]*(1ll<<i);
lat+=((1ll<<i)&cur)*X;
if(now<lat)return false;
}
return true;
}
ll brute_force(ll x, vt<ll> a){
if(x>100000)return 1;
X = x; A = a;k =a.size();
ll ans = 0;
for(ll i = 100000; i >= 0; i--){
if(works(i))ans++;
}
return ans;
}
map<pair<long,long>,long> mp;
ll mthcount(ll x, int cur, ll val){
if(cur==k-1){
return val/x+1;
}
if(val >= x){
ll ans = 0;
ans+= (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1]));
val-=x;
ans+= (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1]));
return ans;
}else{
return (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1]));
}
}
ll count_tastiness(ll x, vt<ll> a){
mp.clear();
A = a;
k = a.size();
return mthcount(x,0,a[0]);
}
컴파일 시 표준 에러 (stderr) 메시지
biscuits.cpp: In function 'll mthcount(ll, int, ll)': biscuits.cpp:57:25: error: expected identifier before '{' token 57 | ans+= (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1])); | ^ biscuits.cpp: In lambda function: biscuits.cpp:57:48: error: expected '{' before ')' token 57 | ans+= (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1])); | ^ biscuits.cpp: In function 'll mthcount(ll, int, ll)': biscuits.cpp:57:48: error: no matching function for call to 'std::map<std::pair<long int, long int>, long int>::find(mthcount(ll, int, ll)::<lambda()>)' In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from biscuits.cpp:1: /usr/include/c++/10/bits/stl_map.h:1169:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) [with _Key = std::pair<long int, long int>; _Tp = long int; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::iterator; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long int, long int>]' 1169 | find(const key_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_map.h:1169:28: note: no known conversion for argument 1 from 'mthcount(ll, int, ll)::<lambda()>' to 'const key_type&' {aka 'const std::pair<long int, long int>&'} 1169 | find(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_map.h:1175:2: note: candidate: 'template<class _Kt> decltype (((std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) [with _Kt = _Kt; _Key = std::pair<long int, long int>; _Tp = long int; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1175 | find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) | ^~~~ /usr/include/c++/10/bits/stl_map.h:1175:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<long int, long int>, long int>::find<_Kt>(const _Kt&) [with _Kt = mthcount(ll, int, ll)::<lambda()>]': biscuits.cpp:57:48: required from here /usr/include/c++/10/bits/stl_map.h:1175:50: error: no matching function for call to 'std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(const mthcount(ll, int, ll)::<lambda()>&)' 1175 | find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/10/map:60, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from biscuits.cpp:1: /usr/include/c++/10/bits/stl_tree.h:1301:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long int, long int>; _Val = std::pair<const std::pair<long int, long int>, long int>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1301 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1301:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_tree.h: In substitution of 'template<class _Cmp, class _SfinaeType> using __has_is_transparent_t = typename std::__has_is_transparent<_Cmp, _SfinaeType>::type [with _Cmp = std::less<std::pair<long int, long int> >; _SfinaeType = mthcount(ll, int, ll)::<lambda()>]': /usr/include/c++/10/bits/stl_tree.h:1299:9: required by substitution of 'template<class _Kt> decltype (((std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<long int, long int>, long int>::find<_Kt>(const _Kt&) [with _Kt = mthcount(ll, int, ll)::<lambda()>]' biscuits.cpp:57:48: required from here /usr/include/c++/10/bits/stl_tree.h:429:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long int, long int> >, mthcount(ll, int, ll)::<lambda()>, void>' 429 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<long int, long int>, long int>::find<_Kt>(const _Kt&) [with _Kt = mthcount(ll, int, ll)::<lambda()>]': biscuits.cpp:57:48: required from here /usr/include/c++/10/bits/stl_tree.h:1310:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long int, long int>; _Val = std::pair<const std::pair<long int, long int>, long int>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1310 | _M_find_tr(const _Kt& __k) const | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1310:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from biscuits.cpp:1: /usr/include/c++/10/bits/stl_map.h:1194:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::pair<long int, long int>; _Tp = long int; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator = std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::const_iterator; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long int, long int>]' 1194 | find(const key_type& __x) const | ^~~~ /usr/include/c++/10/bits/stl_map.h:1194:28: note: no known conversion for argument 1 from 'mthcount(ll, int, ll)::<lambda()>' to 'const key_type&' {aka 'const std::pair<long int, long int>&'} 1194 | find(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_map.h:1200:2: note: candidate: 'template<class _Kt> decltype (((const std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) const [with _Kt = _Kt; _Key = std::pair<long int, long int>; _Tp = long int; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1200 | find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) | ^~~~ /usr/include/c++/10/bits/stl_map.h:1200:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((const std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<long int, long int>, long int>::find<_Kt>(const _Kt&) const [with _Kt = mthcount(ll, int, ll)::<lambda()>]': biscuits.cpp:57:48: required from here /usr/include/c++/10/bits/stl_map.h:1200:56: error: no matching function for call to 'std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(const mthcount(ll, int, ll)::<lambda()>&) const' 1200 | find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/10/map:60, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from biscuits.cpp:1: /usr/include/c++/10/bits/stl_tree.h:1301:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long int, long int>; _Val = std::pair<const std::pair<long int, long int>, long int>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1301 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1301:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_tree.h:1310:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long int, long int>; _Val = std::pair<const std::pair<long int, long int>, long int>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1310 | _M_find_tr(const _Kt& __k) const | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1310:2: note: template argument deduction/substitution failed: biscuits.cpp:59:20: error: expected identifier before '{' token 59 | ans+= (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1])); | ^ biscuits.cpp: In lambda function: biscuits.cpp:59:43: error: expected '{' before ')' token 59 | ans+= (mp.find([{cur+1,val/2+A[cur+1]}])!=mp.end() ? mp[{cur+1,val/2+A[cur+1]}] : mp[{cur+1,val/2+A[cur+1]}] = mthcount(x,cur+1,val/2+A[cur+1])); | ^ biscuits.cpp: In function 'll mthcount(ll, int, ll)': biscuits.cpp:59:43: error: no matching function for call to 'std::map<std::pair<long int, long int>, long int>::find(mthcount(ll, int, ll)::<lambda()>)' In file included from /usr/include/c++/10/map:61, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from biscuits.cpp:1: /usr/include/c++/10/bits/stl_map.h:1169:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const key_type&) [with _Key = std::pair<long int, long int>; _Tp = long int; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::iterator = std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::iterator; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::pair<long int, long int>]' 1169 | find(const key_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_map.h:1169:28: note: no known conversion for argument 1 from 'mthcount(ll, int, ll)::<lambda()>' to 'const key_type&' {aka 'const std::pair<long int, long int>&'} 1169 | find(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_map.h:1175:2: note: candidate: 'template<class _Kt> decltype (((std::map<_Key, _Tp, _Compare, _Alloc>*)this)->std::map<_Key, _Tp, _Compare, _Alloc>::_M_t._M_find_tr(__x)) std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Kt&) [with _Kt = _Kt; _Key = std::pair<long int, long int>; _Tp = long int; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1175 | find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) | ^~~~ /usr/include/c++/10/bits/stl_map.h:1175:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<long int, long int>, long int>::find<_Kt>(const _Kt&) [with _Kt = mthcount(ll, int, ll)::<lambda()>]': biscuits.cpp:59:43: required from here /usr/include/c++/10/bits/stl_map.h:1175:50: error: no matching function for call to 'std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(const mthcount(ll, int, ll)::<lambda()>&)' 1175 | find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) | ~~~~~~~~~~~~~~~^~~~~ In file included from /usr/include/c++/10/map:60, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from biscuits.cpp:1: /usr/include/c++/10/bits/stl_tree.h:1301:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_find_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long int, long int>; _Val = std::pair<const std::pair<long int, long int>, long int>; _KeyOfValue = std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >; _Compare = std::less<std::pair<long int, long int> >; _Alloc = std::allocator<std::pair<const std::pair<long int, long int>, long int> >]' 1301 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1301:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_tree.h: In substitution of 'template<class _Cmp, class _SfinaeType> using __has_is_transparent_t = typename std::__has_is_transparent<_Cmp, _SfinaeType>::type [with _Cmp = std::less<std::pair<long int, long int> >; _SfinaeType = mthcount(ll, int, ll)::<lambda()>]': /usr/include/c++/10/bits/stl_tree.h:1299:9: required by substitution of 'template<class _Kt> decltype (((std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<long int, long int>, long int>::find<_Kt>(const _Kt&) [with _Kt = mthcount(ll, int, ll)::<lambda()>]' biscuits.cpp:59:43: required from here /usr/include/c++/10/bits/stl_tree.h:429:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long int, long int> >, mthcount(ll, int, ll)::<lambda()>, void>' 429 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_map.h: In substitution of 'template<class _Kt> decltype (((std::map<std::pair<long int, long int>, long int>*)this)->std::map<std::pair<long int, long int>, long int>::_M_t.std::_Rb_tree<std::pair<long int, long int>, std::pair<const std::pair<long int, long int>, long int>, std::_Select1st<std::pair<const std::pair<long int, long int>, long int> >, std::less<std::pair<long int, long int> >, std::allocator<std::pair<const std::pair<long int, long int>, long int> > >::_M_find_tr(__x)) std::map<std::pair<lo