| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 128306 | zeyad49 | 선물상자 (IOI15_boxes) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N=1000;
const long long INF=(long)1e18;
long long K,L;
int memo[N][N];
int teams[N];
long long dist[N][N];
long long dp(int l,int r) {
if(l>r)
return 0;
if(memo[l][r]!=-1)
return memo[l][r];
long long ans=INF;
if(r-l+1<=K)
ans=L;
for(int k=l;k<=r;k++){
if(k-l+1>K) break;
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
}
for(int k=r;k>=l;k--){
if(r-k+1>K)
break;
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
}
return memo[l][r]=ans;
}
long long delivery(int a, int b, int c, int x[]) {
K=b;
L=c;
sort(x,x+a);
for(int i=0;i<a;i++){
teams[i]=x[i];
for(int j=0;j<a;j++)
memo[i][j]=-1;
}
return dp(0,a-1);
}
컴파일 시 표준 에러 (stderr) 메시지
boxes.cpp: In function 'long long int dp(int, int)':
boxes.cpp:19:61: error: no matching function for call to 'min(int&, long long int)'
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
from /usr/include/c++/7/cmath:1914,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
min(const _Tp& __a, const _Tp& __b)
^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
boxes.cpp:19:61: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
from /usr/include/c++/7/cmath:1914,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed:
boxes.cpp:19:61: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
^
In file included from /usr/include/c++/7/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
min(initializer_list<_Tp> __l)
^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed:
boxes.cpp:19:61: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
^
In file included from /usr/include/c++/7/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
min(initializer_list<_Tp> __l, _Compare __comp)
^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed:
boxes.cpp:19:61: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
ans=min(ans,teams[k]+dp(k+1,r)+min(teams[k],L-teams[k]));
^
boxes.cpp:24:63: error: no matching function for call to 'min(long long int, int&)'
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
from /usr/include/c++/7/cmath:1914,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: candidate: template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)
min(const _Tp& __a, const _Tp& __b)
^~~
/usr/include/c++/7/bits/stl_algobase.h:195:5: note: template argument deduction/substitution failed:
boxes.cpp:24:63: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
^
In file included from /usr/include/c++/7/bits/specfun.h:45:0,
from /usr/include/c++/7/cmath:1914,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:41,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: candidate: template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^~~
/usr/include/c++/7/bits/stl_algobase.h:243:5: note: template argument deduction/substitution failed:
boxes.cpp:24:63: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
^
In file included from /usr/include/c++/7/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: candidate: template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)
min(initializer_list<_Tp> __l)
^~~
/usr/include/c++/7/bits/stl_algo.h:3450:5: note: template argument deduction/substitution failed:
boxes.cpp:24:63: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
^
In file included from /usr/include/c++/7/algorithm:62:0,
from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
from boxes.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: candidate: template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)
min(initializer_list<_Tp> __l, _Compare __comp)
^~~
/usr/include/c++/7/bits/stl_algo.h:3456:5: note: template argument deduction/substitution failed:
boxes.cpp:24:63: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
ans=min(ans,L-teams[k]+dp(l,k-1)+min(L-teams[k],teams[k]));
^
boxes.cpp:26:21: warning: conversion to 'int' from 'long long int' may alter its value [-Wconversion]
return memo[l][r]=ans;
^~~