# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1118939 | epicci23 | Aliens (IOI16_aliens) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
//#define int long long
#define all(v) v.begin() , v.end()
#define sz(a) (int64_t)a.size()
using namespace std;
const int64_t INF = 1e18;
vector<int64_t> dp,ndp;
vector<array<int64_t,2>> v;
void f(int64_t l,int64_t r,int64_t optl,int64_t optr){
if(l>r) return;
int64_t mid = (l+r)/2;
int64_t cur = INF, best = -1;
for(int i = min(mid,optr) ; i >= max(1LL,optl) ; i--){
int64_t b = v[mid][1];
int64_t a = v[i][0];
int64_t d = (i > 1 ? v[i - 1][1] : 0);
if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){
best = i;
cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a);
}
}
ndp[mid] = cur;
f(l,mid-1,optl,best) , f(mid+1,r,best,optr);
}
int64_t take_photos(int n,int m,int k,vector<int> r,vector<int> c){
for(int i=0;i<n;i++){
int64_t a=r[i],b=c[i];
if(a>b) swap(a,b);
v.push_back({a,b});
}
sort(all(v));
vector<array<int64_t,2>> xdd;
xdd.push_back({-1LL,-1LL});
for(int i=0;i<n;i++) if(xdd.back()[1] < v[i][1]) xdd.push_back(v[i]);
swap(v,xdd);
n = sz(v) - 1;
dp.assign(n+5,INF);
dp[0] = 0;
for(int i=1;i<=k;i++){
ndp.assign(n+5,INF);
f(1,n,1,n);
swap(dp,ndp);
}
return dp[n];
}
/*void _(){
int n,m,k;
cin >> n >> m >> k;
for(int i=0;i<n;i++){
int a,b;
cin >> a >> b;
if(a>b) swap(a,b);
v.push_back({a,b});
}
sort(all(v));
vector<array<int,2>> xdd;
xdd.push_back({-1,-1});
for(int i=0;i<n;i++) if(xdd.back()[1] < v[i][1]) xdd.push_back(v[i]);
swap(v,xdd);
n = sz(v) - 1;
dp.assign(n+5,INF);
dp[0] = 0;
for(int i=1;i<=k;i++){
ndp.assign(n+5,INF);
f(1,n,1,n);
swap(dp,ndp);
}
cout << dp[n] << '\n';
}
int32_t main(){
cin.tie(0); ios::sync_with_stdio(0);
int tc=1;//cin >> tc;
while(tc--) _();
return 0;
}*/
컴파일 시 표준 에러 (stderr) 메시지
aliens.cpp: In function 'void f(int64_t, int64_t, int64_t, int64_t)': aliens.cpp:16:48: error: no matching function for call to 'max(long long int, int64_t&)' 16 | for(int i = min(mid,optr) ; i >= max(1LL,optl) ; i--){ | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:16:48: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 16 | for(int i = min(mid,optr) ; i >= max(1LL,optl) ; i--){ | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:16:48: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 16 | for(int i = min(mid,optr) ; i >= max(1LL,optl) ; i--){ | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:16:48: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 16 | for(int i = min(mid,optr) ; i >= max(1LL,optl) ; i--){ | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:16:48: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 16 | for(int i = min(mid,optr) ; i >= max(1LL,optl) ; i--){ | ^ aliens.cpp:20:45: error: no matching function for call to 'max(long long int, int64_t)' 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:20:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:20:45: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:20:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:20:45: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ aliens.cpp:20:60: error: no matching function for call to 'max(long long int, int64_t)' 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:20:60: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:20:60: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:20:60: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:20:60: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 20 | if(dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a) < cur){ | ^ aliens.cpp:22:50: error: no matching function for call to 'max(long long int, int64_t)' 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:22:50: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:22:50: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:22:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:22:50: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ aliens.cpp:22:65: error: no matching function for call to 'max(long long int, int64_t)' 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:22:65: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/bits/specfun.h:45, from /usr/include/c++/10/cmath:1927, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41, from aliens.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: aliens.cpp:22:65: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int64_t' {aka 'long int'}) 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:22:65: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^ In file included from /usr/include/c++/10/algorithm:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65, from aliens.cpp:1: /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: aliens.cpp:22:65: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int' 22 | cur = dp[i-1] + (b-a) * (b-a) + max(0LL,d-a) * max(0LL,d-a); | ^